From e97eba7c1b098cfbd0481f7b0acbb146282db40d Mon Sep 17 00:00:00 2001 From: Ilyas Salikhov Date: Tue, 1 Oct 2024 17:18:04 +0300 Subject: [PATCH] Remove the support of fos-rest --- Extractor/Handler/FosRestHandler.php | 125 ----------- Resources/config/services.xml | 5 - Resources/doc/other-bundle-annotations.rst | 8 - Tests/Extractor/ApiDocExtractorTest.php | 2 +- .../Extractor/Handler/FosRestHandlerTest.php | 205 ------------------ Tests/Fixtures/Controller/TestController.php | 84 ------- Tests/Fixtures/app/config/routing.yml | 45 ---- Tests/Formatter/MarkdownFormatterTest.php | 2 +- Tests/Formatter/SimpleFormatterTest.php | 2 +- .../testFormat-result-no-dunglas.php | 85 -------- Tests/Formatter/testFormat-result.markdown | 58 ----- Tests/Formatter/testFormat-result.php | 89 -------- Tests/Formatter/testFormat-result_1.markdown | 90 -------- Tests/Formatter/testFormat-result_1.php | 147 +------------ Tests/bootstrap.php | 4 - composer.json | 2 - 16 files changed, 8 insertions(+), 945 deletions(-) delete mode 100644 Extractor/Handler/FosRestHandler.php delete mode 100644 Tests/Extractor/Handler/FosRestHandlerTest.php diff --git a/Extractor/Handler/FosRestHandler.php b/Extractor/Handler/FosRestHandler.php deleted file mode 100644 index b7b36a2..0000000 --- a/Extractor/Handler/FosRestHandler.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Nelmio\ApiDocBundle\Extractor\Handler; - -use FOS\RestBundle\Controller\Annotations\QueryParam; -use FOS\RestBundle\Controller\Annotations\RequestParam; -use Nelmio\ApiDocBundle\Annotation\ApiDoc; -use Nelmio\ApiDocBundle\DataTypes; -use Nelmio\ApiDocBundle\Extractor\HandlerInterface; -use Symfony\Component\Routing\Route; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\Regex; - -class FosRestHandler implements HandlerInterface -{ - public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method): void - { - foreach ($annotations as $annot) { - if ($annot instanceof RequestParam) { - $requirements = $this->handleRequirements($annot->requirements); - $data = [ - 'required' => $annot->strict && false === $annot->nullable && null === $annot->default, - 'dataType' => $requirements . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''), - 'actualType' => $this->inferType($requirements), - 'subType' => null, - 'description' => $annot->description, - 'readonly' => false, - ]; - if (false === $annot->strict) { - $data['default'] = $annot->default; - } - $annotation->addParameter($annot->name, $data); - } elseif ($annot instanceof QueryParam) { - if ($annot->strict && false === $annot->nullable && null === $annot->default) { - $annotation->addRequirement($annot->name, [ - 'requirement' => $this->handleRequirements($annot->requirements) . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''), - 'dataType' => '', - 'description' => $annot->description, - ]); - } elseif (null !== $annot->default) { - $annotation->addFilter($annot->name, [ - 'requirement' => $this->handleRequirements($annot->requirements) . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''), - 'description' => $annot->description, - 'default' => $annot->default, - ]); - } elseif (null !== $annot->requirements) { - $annotation->addFilter($annot->name, [ - 'requirement' => $this->handleRequirements($annot->requirements) . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''), - 'description' => $annot->description, - ]); - } else { - $annotation->addFilter($annot->name, [ - 'description' => $annot->description, - ]); - } - } - } - } - - /** - * Handle FOSRestBundle requirements in order to return a string. - * - * @return string - */ - private function handleRequirements($requirements) - { - if (is_object($requirements) && $requirements instanceof Constraint) { - if ($requirements instanceof Regex) { - return $requirements->getHtmlPattern(); - } - $class = $requirements::class; - - return substr($class, strrpos($class, '\\') + 1); - } - - if (is_array($requirements) && isset($requirements['rule'])) { - return (string) $requirements['rule']; - } - - if (is_array($requirements) && array_key_exists(0, $requirements)) { - $output = []; - - foreach ($requirements as $req) { - if (is_object($req) && $req instanceof Constraint) { - if ($req instanceof Regex) { - $output[] = $req->getHtmlPattern(); - } else { - $class = $req::class; - $output[] = substr($class, strrpos($class, '\\') + 1); - } - } - - if (is_array($req)) { - if (array_key_exists('_format', $req)) { - $output[] = 'Format: ' . $req['_format']; - } elseif (isset($req['rule'])) { - $output[] = $req['rule']; - } - } - } - - return implode(', ', $output); - } - - return (string) $requirements; - } - - public function inferType($requirement) - { - if (DataTypes::isPrimitive($requirement)) { - return $requirement; - } - - return DataTypes::STRING; - } -} diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 87ec925..a03fcee 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -9,7 +9,6 @@ Nelmio\ApiDocBundle\Twig\Extension\MarkdownExtension Nelmio\ApiDocBundle\Util\DocCommentExtractor - Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler @@ -43,10 +42,6 @@ - - - - diff --git a/Resources/doc/other-bundle-annotations.rst b/Resources/doc/other-bundle-annotations.rst index dd1fbfc..61cd338 100644 --- a/Resources/doc/other-bundle-annotations.rst +++ b/Resources/doc/other-bundle-annotations.rst @@ -1,14 +1,6 @@ Other Bundle Annotations ======================== -This bundle will get information from the following other annotations: - -* ``@FOS\RestBundle\Controller\Annotations\RequestParam`` - use as ``parameters`` -* ``@FOS\RestBundle\Controller\Annotations\QueryParam`` - use as ``requirements`` - (when strict parameter is true), ``filters`` (when strict is false) -* ``@JMS\SecurityExtraBundle\Annotation\Secure`` - set ``authentication`` to true, - ``authenticationRoles`` to the given roles - PHPDoc ------ diff --git a/Tests/Extractor/ApiDocExtractorTest.php b/Tests/Extractor/ApiDocExtractorTest.php index 25bbe1d..56ec9a8 100644 --- a/Tests/Extractor/ApiDocExtractorTest.php +++ b/Tests/Extractor/ApiDocExtractorTest.php @@ -19,7 +19,7 @@ class ApiDocExtractorTest extends WebTestCase { public const NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE = 5; - private static $ROUTES_QUANTITY_DEFAULT = 36; // Routes in the default view + private static $ROUTES_QUANTITY_DEFAULT = 28; // Routes in the default view private static $ROUTES_QUANTITY_PREMIUM = 5; // Routes in the premium view private static $ROUTES_QUANTITY_TEST = 2; // Routes in the test view diff --git a/Tests/Extractor/Handler/FosRestHandlerTest.php b/Tests/Extractor/Handler/FosRestHandlerTest.php deleted file mode 100644 index 8f53446..0000000 --- a/Tests/Extractor/Handler/FosRestHandlerTest.php +++ /dev/null @@ -1,205 +0,0 @@ - -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -namespace Nelmio\ApiDocBundle\Tests\Extractor; - -use Nelmio\ApiDocBundle\Tests\WebTestCase; - -class FosRestHandlerTest extends WebTestCase -{ - public function testGetWithQueryParamStrict(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamStrictAction', 'test_route_15'); - - $this->assertNotNull($annotation); - - $requirements = $annotation->getRequirements(); - $this->assertCount(1, $requirements); - $this->assertArrayHasKey('page', $requirements); - - $requirement = $requirements['page']; - - $this->assertArrayHasKey('requirement', $requirement); - $this->assertEquals($requirement['requirement'], '\d+'); - - $this->assertArrayHasKey('description', $requirement); - $this->assertEquals($requirement['description'], 'Page of the overview.'); - - $this->assertArrayHasKey('dataType', $requirement); - - $this->assertArrayNotHasKey('default', $requirement); - } - - public function testGetWithQueryParam(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamAction', 'test_route_8'); - - $this->assertNotNull($annotation); - - $filters = $annotation->getFilters(); - $this->assertCount(1, $filters); - $this->assertArrayHasKey('page', $filters); - - $filter = $filters['page']; - - $this->assertArrayHasKey('requirement', $filter); - $this->assertEquals($filter['requirement'], '\d+'); - - $this->assertArrayHasKey('description', $filter); - $this->assertEquals($filter['description'], 'Page of the overview.'); - - $this->assertArrayHasKey('default', $filter); - $this->assertEquals($filter['default'], '1'); - } - - public function testGetWithQueryParamNoDefault(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamNoDefaultAction', 'test_route_16'); - - $this->assertNotNull($annotation); - - $filters = $annotation->getFilters(); - $this->assertCount(1, $filters); - $this->assertArrayHasKey('page', $filters); - - $filter = $filters['page']; - - $this->assertArrayHasKey('requirement', $filter); - $this->assertEquals($filter['requirement'], '\d+'); - - $this->assertArrayHasKey('description', $filter); - $this->assertEquals($filter['description'], 'Page of the overview.'); - - $this->assertArrayNotHasKey('default', $filter); - } - - public function testGetWithConstraintAsRequirements(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithConstraintAsRequirements', 'test_route_21'); - - $this->assertNotNull($annotation); - - $filters = $annotation->getFilters(); - $this->assertCount(1, $filters); - $this->assertArrayHasKey('mail', $filters); - - $filter = $filters['mail']; - - $this->assertArrayHasKey('requirement', $filter); - $this->assertEquals($filter['requirement'], 'Email'); - } - - public function testGetWithRequestParam(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequestParamAction', 'test_route_11'); - - $this->assertNotNull($annotation); - - $parameters = $annotation->getParameters(); - $this->assertCount(1, $parameters); - $this->assertArrayHasKey('param1', $parameters); - - $parameter = $parameters['param1']; - - $this->assertArrayHasKey('dataType', $parameter); - $this->assertEquals($parameter['dataType'], 'string'); - - $this->assertArrayHasKey('description', $parameter); - $this->assertEquals($parameter['description'], 'Param1 description.'); - - $this->assertArrayHasKey('required', $parameter); - $this->assertEquals($parameter['required'], true); - - $this->assertArrayNotHasKey('default', $parameter); - } - - public function testGetWithRequestParamNullable(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithNullableRequestParamAction', 'test_route_22'); - - $this->assertNotNull($annotation); - - $parameters = $annotation->getParameters(); - $this->assertCount(1, $parameters); - $this->assertArrayHasKey('param1', $parameters); - - $parameter = $parameters['param1']; - - $this->assertArrayHasKey('dataType', $parameter); - $this->assertEquals($parameter['dataType'], 'string'); - - $this->assertArrayHasKey('description', $parameter); - $this->assertEquals($parameter['description'], 'Param1 description.'); - - $this->assertArrayHasKey('required', $parameter); - $this->assertEquals($parameter['required'], false); - - $this->assertArrayNotHasKey('default', $parameter); - } - - public function testWithRequestParamArrayRequirements(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamArrayRequirementsAction', 'test_route_29'); - - $this->assertNotNull($annotation); - $filters = $annotation->getFilters(); - - $this->assertArrayHasKey('param1', $filters); - $this->assertArrayHasKey('requirement', $filters['param1']); - $this->assertEquals('regexp', $filters['param1']['requirement']); - } - - public function testWithRequestParamPlainArrayRequirements(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamPlainArrayRequirementsAction', 'test_route_30'); - - $this->assertNotNull($annotation); - $filters = $annotation->getFilters(); - - $this->assertArrayHasKey('param1', $filters); - $this->assertArrayHasKey('requirement', $filters['param1']); - $this->assertEquals('NotNull, NotBlank', $filters['param1']['requirement']); - } - - public function testWithRequirementParamNotSet(): void - { - $container = $this->getContainer(); - $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - $annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequirementParamNotSet', 'test_route_31'); - - $this->assertNotNull($annotation); - - $filters = $annotation->getFilters(); - $this->assertCount(1, $filters); - $this->assertArrayHasKey('param1', $filters); - $filter = $filters['param1']; - - $this->assertArrayNotHasKey('requirement', $filter); - $this->assertArrayHasKey('description', $filter); - $this->assertEquals($filter['description'], 'Param1 description.'); - } -} diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index e757648..ab94a74 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -11,12 +11,9 @@ namespace Nelmio\ApiDocBundle\Tests\Fixtures\Controller; -use FOS\RestBundle\Controller\Annotations\QueryParam; -use FOS\RestBundle\Controller\Annotations\RequestParam; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Nelmio\ApiDocBundle\Tests\Fixtures\DependencyTypePath; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Validator\Constraints as Assert; class TestController { @@ -128,42 +125,6 @@ class TestController { } - /** - * @ApiDoc() - * - * @QueryParam(strict=true, name="page", requirements="\d+", description="Page of the overview.") - */ - public function zActionWithQueryParamStrictAction(): void - { - } - - /** - * @ApiDoc() - * - * @QueryParam(name="page", requirements="\d+", default="1", description="Page of the overview.") - */ - public function zActionWithQueryParamAction(): void - { - } - - /** - * @ApiDoc() - * - * @QueryParam(name="page", requirements="\d+", description="Page of the overview.") - */ - public function zActionWithQueryParamNoDefaultAction(): void - { - } - - /** - * @ApiDoc() - * - * @QueryParam(name="mail", requirements=@Assert\Email, description="Email of someone.") - */ - public function zActionWithConstraintAsRequirements(): void - { - } - /** * @ApiDoc( * description="Testing JMS", @@ -184,24 +145,6 @@ class TestController { } - /** - * @ApiDoc() - * - * @RequestParam(name="param1", requirements="string", description="Param1 description.") - */ - public function zActionWithRequestParamAction(): void - { - } - - /** - * @ApiDoc() - * - * @RequestParam(name="param1", requirements="string", description="Param1 description.", nullable=true) - */ - public function zActionWithNullableRequestParamAction(): void - { - } - /** * @ApiDoc() */ @@ -400,31 +343,4 @@ class TestController public function routeWithHostAction(): void { } - - /** - * @ApiDoc() - * - * @QueryParam(name="param1", requirements={"rule": "regexp", "error_message": "warning"}, description="Param1 description.") - */ - public function routeWithQueryParamArrayRequirementsAction(): void - { - } - - /** - * @ApiDoc() - * - * @QueryParam(name="param1", requirements={@Assert\NotNull(), @Assert\NotBlank()}, description="Param1 description.") - */ - public function routeWithQueryParamPlainArrayRequirementsAction(): void - { - } - - /** - * @ApiDoc() - * - * @QueryParam(name="param1", description="Param1 description.") - */ - public function zActionWithRequirementParamNotSet(): void - { - } } diff --git a/Tests/Fixtures/app/config/routing.yml b/Tests/Fixtures/app/config/routing.yml index 4ad6766..3387f7b 100644 --- a/Tests/Fixtures/app/config/routing.yml +++ b/Tests/Fixtures/app/config/routing.yml @@ -32,11 +32,6 @@ test_route_7: methods: [POST] defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::anotherPostAction, _format: json } -test_route_8: - path: /z-action-with-query-param - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamAction } - test_route_9: path: /jms-input-test methods: [POST] @@ -47,11 +42,6 @@ test_route_10: methods: [GET] defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::jmsReturnTestAction } -test_route_11: - path: /z-action-with-request-param - methods: [POST] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequestParamAction } - test_route_12: path: /secure-route schemes: [https] @@ -89,16 +79,6 @@ test_route_14: methods: [POST] defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::postTest2Action, _format: json } -test_route_15: - path: /z-action-with-query-param-strict - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamStrictAction } - -test_route_16: - path: /z-action-with-query-param-no-default - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamNoDefaultAction } - test_route_17: path: /z-action-with-deprecated-indicator methods: [GET] @@ -136,16 +116,6 @@ test_route_exclusive: path: /exclusive defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::exclusiveAction } -test_route_21: - path: /z-action-with-constraint-requirements - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithConstraintAsRequirementsAction } - -test_route_22: - path: /z-action-with-nullable-request-param - methods: [POST] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithNullableRequestParamAction } - test_route_list_resource: path: /api/resources.{_format} methods: [GET] @@ -239,21 +209,6 @@ test_route_28: domain: "%domain_dev%|%domain_prod%" defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithHostAction, domain: "%domain_dev%", _format: json } -test_route_29: - path: /z-query-param-array-requirements - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamArrayRequirementsAction } - -test_route_30: - path: /z-query-param-plain-array-requirements - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamPlainArrayRequirementsAction } - -test_route_31: - path: /z-query-requirement-param-not-set - methods: [GET] - defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequirementParamNotSet } - test_route_version_checking: path: /zz-tests-route-version.{_format} methods: [GET] diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index 65294f6..f844b9a 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -32,7 +32,7 @@ class MarkdownFormatterTest extends WebTestCase $expected = str_replace('DependencyType', 'dependency_type', $expected); } - $this->assertEquals($expected, $result . "\n"); + $this->assertEquals($expected, $result . "\n", 'file ' . __DIR__ . '/testFormat-result' . $suffix . '.markdown'); } public function testFormatOne(): void diff --git a/Tests/Formatter/SimpleFormatterTest.php b/Tests/Formatter/SimpleFormatterTest.php index ce2da43..3f5d459 100644 --- a/Tests/Formatter/SimpleFormatterTest.php +++ b/Tests/Formatter/SimpleFormatterTest.php @@ -28,7 +28,7 @@ class SimpleFormatterTest extends WebTestCase $suffix = class_exists('Dunglas\ApiBundle\DunglasApiBundle') ? '' : '_1'; $expected = require __DIR__ . '/testFormat-result' . $suffix . '.php'; - $this->assertEquals($expected, $result); + $this->assertEquals($expected, $result, 'file ' . __DIR__ . '/testFormat-result' . $suffix . '.php'); } public function testFormatOne(): void diff --git a/Tests/Formatter/testFormat-result-no-dunglas.php b/Tests/Formatter/testFormat-result-no-dunglas.php index a29df9a..a06f9f0 100644 --- a/Tests/Formatter/testFormat-result-no-dunglas.php +++ b/Tests/Formatter/testFormat-result-no-dunglas.php @@ -1816,91 +1816,6 @@ With multiple lines.', ], 'deprecated' => true, ], - 12 => [ - 'method' => 'POST', - 'uri' => '/z-action-with-nullable-request-param', - 'parameters' => [ - 'param1' => [ - 'required' => false, - 'dataType' => 'string', - 'actualType' => 'string', - 'subType' => null, - 'description' => 'Param1 description.', - 'readonly' => false, - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - ], - 13 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param', - 'filters' => [ - 'page' => [ - 'requirement' => '\\d+', - 'description' => 'Page of the overview.', - 'default' => '1', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - ], - 14 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param-no-default', - 'filters' => [ - 'page' => [ - 'requirement' => '\\d+', - 'description' => 'Page of the overview.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - ], - 15 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param-strict', - 'requirements' => [ - 'page' => [ - 'requirement' => '\\d+', - 'dataType' => '', - 'description' => 'Page of the overview.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - ], - 16 => [ - 'method' => 'POST', - 'uri' => '/z-action-with-request-param', - 'parameters' => [ - 'param1' => [ - 'required' => true, - 'dataType' => 'string', - 'actualType' => 'string', - 'subType' => null, - 'description' => 'Param1 description.', - 'readonly' => false, - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - ], 17 => [ 'method' => 'ANY', 'uri' => '/z-return-jms-and-validator-output', diff --git a/Tests/Formatter/testFormat-result.markdown b/Tests/Formatter/testFormat-result.markdown index 2c16f07..6c32ae4 100644 --- a/Tests/Formatter/testFormat-result.markdown +++ b/Tests/Formatter/testFormat-result.markdown @@ -853,64 +853,6 @@ _Route with host placeholder_ -### `POST` /z-action-with-nullable-request-param ### - - -#### Parameters #### - -param1: - - * type: string - * required: false - * description: Param1 description. - - -### `GET` /z-action-with-query-param ### - - -#### Filters #### - -page: - - * Requirement: \d+ - * Description: Page of the overview. - * Default: 1 - - -### `GET` /z-action-with-query-param-no-default ### - - -#### Filters #### - -page: - - * Requirement: \d+ - * Description: Page of the overview. - - -### `GET` /z-action-with-query-param-strict ### - - -#### Requirements #### - -**page** - - - Requirement: \d+ - - Description: Page of the overview. - - -### `POST` /z-action-with-request-param ### - - -#### Parameters #### - -param1: - - * type: string - * required: true - * description: Param1 description. - - ### `ANY` /z-return-jms-and-validator-output ### diff --git a/Tests/Formatter/testFormat-result.php b/Tests/Formatter/testFormat-result.php index de5b26b..30afe5b 100644 --- a/Tests/Formatter/testFormat-result.php +++ b/Tests/Formatter/testFormat-result.php @@ -1967,95 +1967,6 @@ With multiple lines.', 'deprecated' => true, 'scope' => null, ], - 17 => [ - 'method' => 'POST', - 'uri' => '/z-action-with-nullable-request-param', - 'parameters' => [ - 'param1' => [ - 'required' => false, - 'dataType' => 'string', - 'actualType' => 'string', - 'subType' => null, - 'description' => 'Param1 description.', - 'readonly' => false, - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 18 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param', - 'filters' => [ - 'page' => [ - 'requirement' => '\\d+', - 'description' => 'Page of the overview.', - 'default' => '1', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 19 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param-no-default', - 'filters' => [ - 'page' => [ - 'requirement' => '\\d+', - 'description' => 'Page of the overview.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 20 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param-strict', - 'requirements' => [ - 'page' => [ - 'requirement' => '\\d+', - 'dataType' => '', - 'description' => 'Page of the overview.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - ], - 21 => [ - 'method' => 'POST', - 'uri' => '/z-action-with-request-param', - 'parameters' => [ - 'param1' => [ - 'required' => true, - 'dataType' => 'string', - 'actualType' => 'string', - 'subType' => null, - 'description' => 'Param1 description.', - 'readonly' => false, - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], 22 => [ 'method' => 'ANY', 'uri' => '/z-return-jms-and-validator-output', diff --git a/Tests/Formatter/testFormat-result_1.markdown b/Tests/Formatter/testFormat-result_1.markdown index f023860..bbb1ad6 100644 --- a/Tests/Formatter/testFormat-result_1.markdown +++ b/Tests/Formatter/testFormat-result_1.markdown @@ -710,96 +710,6 @@ _Route with host placeholder_ -### `POST` /z-action-with-nullable-request-param ### - - -#### Parameters #### - -param1: - - * type: string - * required: false - * description: Param1 description. - - -### `GET` /z-action-with-query-param ### - - -#### Filters #### - -page: - - * Requirement: \d+ - * Description: Page of the overview. - * Default: 1 - - -### `GET` /z-action-with-query-param-no-default ### - - -#### Filters #### - -page: - - * Requirement: \d+ - * Description: Page of the overview. - - -### `GET` /z-action-with-query-param-strict ### - - -#### Requirements #### - -**page** - - - Requirement: \d+ - - Description: Page of the overview. - - -### `POST` /z-action-with-request-param ### - - -#### Parameters #### - -param1: - - * type: string - * required: true - * description: Param1 description. - - -### `GET` /z-query-param-array-requirements ### - - -#### Filters #### - -param1: - - * Requirement: regexp - * Description: Param1 description. - - -### `GET` /z-query-param-plain-array-requirements ### - - -#### Filters #### - -param1: - - * Requirement: NotNull, NotBlank - * Description: Param1 description. - - -### `GET` /z-query-requirement-param-not-set ### - - -#### Filters #### - -param1: - - * Description: Param1 description. - - ### `ANY` /z-return-jms-and-validator-output ### diff --git a/Tests/Formatter/testFormat-result_1.php b/Tests/Formatter/testFormat-result_1.php index a92292e..a8163f4 100644 --- a/Tests/Formatter/testFormat-result_1.php +++ b/Tests/Formatter/testFormat-result_1.php @@ -1750,143 +1750,6 @@ With multiple lines.', 'scope' => null, ], 12 => [ - 'method' => 'POST', - 'uri' => '/z-action-with-nullable-request-param', - 'parameters' => [ - 'param1' => [ - 'required' => false, - 'dataType' => 'string', - 'actualType' => 'string', - 'subType' => null, - 'description' => 'Param1 description.', - 'readonly' => false, - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 13 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param', - 'filters' => [ - 'page' => [ - 'requirement' => '\\d+', - 'description' => 'Page of the overview.', - 'default' => '1', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 14 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param-no-default', - 'filters' => [ - 'page' => [ - 'requirement' => '\\d+', - 'description' => 'Page of the overview.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 15 => [ - 'method' => 'GET', - 'uri' => '/z-action-with-query-param-strict', - 'requirements' => [ - 'page' => [ - 'requirement' => '\\d+', - 'dataType' => '', - 'description' => 'Page of the overview.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 16 => [ - 'method' => 'POST', - 'uri' => '/z-action-with-request-param', - 'parameters' => [ - 'param1' => [ - 'required' => true, - 'dataType' => 'string', - 'actualType' => 'string', - 'subType' => null, - 'description' => 'Param1 description.', - 'readonly' => false, - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 17 => [ - 'method' => 'GET', - 'uri' => '/z-query-param-array-requirements', - 'filters' => [ - 'param1' => [ - 'requirement' => 'regexp', - 'description' => 'Param1 description.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 18 => [ - 'method' => 'GET', - 'uri' => '/z-query-param-plain-array-requirements', - 'filters' => [ - 'param1' => [ - 'requirement' => 'NotNull, NotBlank', - 'description' => 'Param1 description.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 19 => [ - 'method' => 'GET', - 'uri' => '/z-query-requirement-param-not-set', - 'filters' => [ - 'param1' => [ - 'description' => 'Param1 description.', - ], - ], - 'https' => false, - 'authentication' => false, - 'authenticationRoles' => [ - ], - 'deprecated' => false, - 'scope' => null, - ], - 20 => [ 'method' => 'ANY', 'uri' => '/z-return-jms-and-validator-output', 'response' => [ @@ -2006,7 +1869,7 @@ With multiple lines.', 'deprecated' => false, 'scope' => null, ], - 21 => [ + 13 => [ 'method' => 'ANY', 'uri' => '/z-return-selected-parsers-input', 'parameters' => [ @@ -2054,7 +1917,7 @@ With multiple lines.', 'deprecated' => false, 'scope' => null, ], - 22 => [ + 14 => [ 'method' => 'ANY', 'uri' => '/z-return-selected-parsers-output', 'response' => [ @@ -2174,7 +2037,7 @@ With multiple lines.', 'deprecated' => false, 'scope' => null, ], - 23 => [ + 15 => [ 'method' => 'POST', 'uri' => '/zcached', 'https' => false, @@ -2184,7 +2047,7 @@ With multiple lines.', 'deprecated' => false, 'scope' => null, ], - 24 => [ + 16 => [ 'method' => 'POST', 'uri' => '/zsecured', 'https' => false, @@ -2194,7 +2057,7 @@ With multiple lines.', 'deprecated' => false, 'scope' => null, ], - 25 => [ + 17 => [ 'method' => 'GET', 'uri' => '/zz-tests-route-version.{_format}', 'requirements' => [ diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index eb79afa..68b11dc 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -13,9 +13,5 @@ if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$load 'php composer.phar install' . PHP_EOL); } -if (class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) { - Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$loader, 'loadClass']); -} - // force loading the ApiDoc annotation since the composer target-dir autoloader does not run through $loader::loadClass class_exists('Nelmio\ApiDocBundle\Annotation\ApiDoc'); diff --git a/composer.json b/composer.json index 6de6f23..5a465c3 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "require-dev": { "doctrine/annotations": "^1.0", "friendsofphp/php-cs-fixer": "^3", - "friendsofsymfony/rest-bundle": "^3.7", "jms/serializer": "^3.15", "jms/serializer-bundle": "^4.1|^5.4", "phpunit/phpunit": "~9.5", @@ -45,7 +44,6 @@ "suggest": { "symfony/form": "For using form definitions as input.", "symfony/validator": "For making use of validator information in the doc.", - "friendsofsymfony/rest-bundle": "For making use of REST information in the doc.", "jms/serializer": "For making use of serializer information in the doc." }, "autoload": {