diff --git a/Describer/ApiPlatformDescriber.php b/Describer/ApiPlatformDescriber.php index 411d8cf..f36ebdf 100644 --- a/Describer/ApiPlatformDescriber.php +++ b/Describer/ApiPlatformDescriber.php @@ -14,32 +14,15 @@ namespace Nelmio\ApiDocBundle\Describer; use ApiPlatform\Core\Documentation\Documentation; use ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\RequestContext; final class ApiPlatformDescriber extends ExternalDocDescriber { public function __construct(Documentation $documentation, DocumentationNormalizer $normalizer, UrlGeneratorInterface $urlGenerator) { parent::__construct(function () use ($documentation, $normalizer, $urlGenerator) { - $paths = []; - $baseContext = $urlGenerator->getContext(); - $urlGenerator->setContext(new RequestContext()); - - try { - $basePath = $urlGenerator->generate('api_entrypoint'); - } finally { - $urlGenerator->setContext($baseContext); - } - $documentation = (array) $normalizer->normalize($documentation); unset($documentation['basePath']); - foreach ($documentation['paths'] as $path => $value) { - $paths['/'.ltrim($basePath.'/'.ltrim($path, '/'), '/')] = $value; - } - - $documentation['paths'] = $paths; - return $documentation; }); } diff --git a/composer.json b/composer.json index 17855e1..7d90cd6 100644 --- a/composer.json +++ b/composer.json @@ -37,9 +37,10 @@ "symfony/stopwatch": "^3.4|^4.0", "sensio/framework-extra-bundle": "^3.0", "doctrine/annotations": "^1.2", + "doctrine/common": "^2.4", "phpdocumentor/reflection-docblock": "^3.1", - "api-platform/core": "^2.0.3", + "api-platform/core": "^2.1.0", "friendsofsymfony/rest-bundle": "^2.0", "jms/serializer-bundle": "^2.0" },