mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Fix Api-Platform support
This commit is contained in:
parent
37efa7228b
commit
444c4608ad
@ -12,13 +12,18 @@
|
|||||||
namespace Nelmio\ApiDocBundle\Describer;
|
namespace Nelmio\ApiDocBundle\Describer;
|
||||||
|
|
||||||
use ApiPlatform\Core\Documentation\Documentation;
|
use ApiPlatform\Core\Documentation\Documentation;
|
||||||
|
use ApiPlatform\Core\Swagger\Serializer\ApiGatewayNormalizer;
|
||||||
use ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer;
|
use ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
final class ApiPlatformDescriber extends ExternalDocDescriber
|
final class ApiPlatformDescriber extends ExternalDocDescriber
|
||||||
{
|
{
|
||||||
public function __construct(Documentation $documentation, DocumentationNormalizer $normalizer, UrlGeneratorInterface $urlGenerator)
|
public function __construct(Documentation $documentation, $normalizer, UrlGeneratorInterface $urlGenerator)
|
||||||
{
|
{
|
||||||
|
if (!$normalizer instanceof ApiGatewayNormalizer && !$normalizer instanceof DocumentationNormalizer) {
|
||||||
|
throw new \LogicException(sprintf('Argument $normalizer of %s must be an instance of %s or %s. %s provided.', __METHOD__, ApiGatewayNormalizer::class, DocumentationNormalizer::class, get_class($normalizer)));
|
||||||
|
}
|
||||||
|
|
||||||
parent::__construct(function () use ($documentation, $normalizer, $urlGenerator) {
|
parent::__construct(function () use ($documentation, $normalizer, $urlGenerator) {
|
||||||
$documentation = (array) $normalizer->normalize($documentation);
|
$documentation = (array) $normalizer->normalize($documentation);
|
||||||
unset($documentation['basePath']);
|
unset($documentation['basePath']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user