From 684391a5fab4bdfac752560d3483d0f7109448a5 Mon Sep 17 00:00:00 2001 From: Max <63156410+mazumba@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:37:45 +0200 Subject: [PATCH] feat(#2297): (Symfony 7.1) Add MapRequestPayload array parameter handling (#2298) | Q | A | |---------------|---------------------------------------------------------------------------------------------------------------------------| | Bug fix? | no | | New feature? | yes | | Deprecations? | no | | Issues | Fix #2297 | With Symfony 7.1, a new `type` parameter has been introduced for `MapRequestPayload` that allows array Controller parameters to be resolved. This currently leads to an error when the Describer tries to register a new Model, because the parameter type `array` is used in this case. To resolve the issue, the given `type` parameter form the `MapRequestPayload` should be used instead. I tried to test this as gracefully as possible. Any more elegant suggestions are welcome! --------- Co-authored-by: Maximilian Zumbansen Co-authored-by: djordy --- src/Processor/MapRequestPayloadProcessor.php | 13 +- .../SymfonyMapRequestPayloadDescriber.php | 9 +- .../Functional/Controller/ApiController81.php | 188 -- .../MapQueryParameterController.php | 79 + .../Controller/MapQueryStringController.php | 10 +- .../Controller/MapRequestPayloadArray.php | 33 + .../MapRequestPayloadController.php | 66 + tests/Functional/ControllerTest.php | 24 + .../Fixtures/MapQueryParameterController.json | 229 ++ .../MapQueryStringCleanupComponents.json | 2146 +---------------- .../Fixtures/MapQueryStringController.json | 2146 +---------------- .../Fixtures/MapRequestPayloadArray.json | 116 + .../Fixtures/MapRequestPayloadController.json | 199 ++ tests/Functional/SymfonyFunctionalTest.php | 833 ------- .../SymfonyMapRequestPayloadDescriberTest.php | 77 + .../fixture/SomeObject.php | 18 + 16 files changed, 925 insertions(+), 5261 deletions(-) create mode 100644 tests/Functional/Controller/MapQueryParameterController.php create mode 100644 tests/Functional/Controller/MapRequestPayloadArray.php create mode 100644 tests/Functional/Controller/MapRequestPayloadController.php create mode 100644 tests/Functional/Fixtures/MapQueryParameterController.json create mode 100644 tests/Functional/Fixtures/MapRequestPayloadArray.json create mode 100644 tests/Functional/Fixtures/MapRequestPayloadController.json delete mode 100644 tests/Functional/SymfonyFunctionalTest.php create mode 100644 tests/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriberTest.php create mode 100644 tests/RouteDescriber/RouteArgumentDescriber/fixture/SomeObject.php diff --git a/src/Processor/MapRequestPayloadProcessor.php b/src/Processor/MapRequestPayloadProcessor.php index 36cc345ac..ea0f41c22 100644 --- a/src/Processor/MapRequestPayloadProcessor.php +++ b/src/Processor/MapRequestPayloadProcessor.php @@ -70,8 +70,17 @@ public function __invoke(Analysis $analysis): void } $contentSchema = $this->getContentSchemaForType($requestBody, $format); - - Util::modifyAnnotationValue($contentSchema, 'ref', $modelRef); + if ('array' === $argumentMetaData->getType()) { + $contentSchema->type = 'array'; + $contentSchema->items = new OA\Items( + [ + 'ref' => $modelRef, + '_context' => Util::createWeakContext($contentSchema->_context), + ] + ); + } else { + Util::modifyAnnotationValue($contentSchema, 'ref', $modelRef); + } if ($argumentMetaData->isNullable()) { $contentSchema->nullable = true; diff --git a/src/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriber.php b/src/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriber.php index 5969960f5..4e5115ec6 100644 --- a/src/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriber.php +++ b/src/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriber.php @@ -35,8 +35,15 @@ public function describe(ArgumentMetadata $argumentMetadata, OA\Operation $opera return; } + $typeClass = $argumentMetadata->getType(); + + $reflectionAttribute = new \ReflectionClass(MapRequestPayload::class); + if (Type::BUILTIN_TYPE_ARRAY === $typeClass && $reflectionAttribute->hasProperty('type') && null !== $attribute->type) { + $typeClass = $attribute->type; + } + $modelRef = $this->modelRegistry->register(new Model( - new Type(Type::BUILTIN_TYPE_OBJECT, false, $argumentMetadata->getType()), + new Type(Type::BUILTIN_TYPE_OBJECT, false, $typeClass), groups: $this->getGroups($attribute), serializationContext: $attribute->serializationContext, )); diff --git a/tests/Functional/Controller/ApiController81.php b/tests/Functional/Controller/ApiController81.php index 489c92ca4..f681f4bc6 100644 --- a/tests/Functional/Controller/ApiController81.php +++ b/tests/Functional/Controller/ApiController81.php @@ -28,16 +28,11 @@ use Nelmio\ApiDocBundle\Tests\Functional\Entity\EntityWithObjectType; use Nelmio\ApiDocBundle\Tests\Functional\Entity\EntityWithRef; use Nelmio\ApiDocBundle\Tests\Functional\Entity\EntityWithUuid; -use Nelmio\ApiDocBundle\Tests\Functional\Entity\QueryModel\ArrayQueryModel; -use Nelmio\ApiDocBundle\Tests\Functional\Entity\QueryModel\FilterQueryModel; -use Nelmio\ApiDocBundle\Tests\Functional\Entity\QueryModel\PaginationQueryModel; -use Nelmio\ApiDocBundle\Tests\Functional\Entity\QueryModel\SortQueryModel; use Nelmio\ApiDocBundle\Tests\Functional\Entity\RangeInteger; use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyConstraints81; use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyConstraintsWithValidationGroups; use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyDiscriminator81; use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyDiscriminatorFileMapping; -use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyMapQueryString; use Nelmio\ApiDocBundle\Tests\Functional\Entity\User; use Nelmio\ApiDocBundle\Tests\Functional\EntityExcluded\Symfony7\SerializedNameEntity; use Nelmio\ApiDocBundle\Tests\Functional\Form\DummyType; @@ -48,9 +43,6 @@ use Nelmio\ApiDocBundle\Tests\Functional\Form\FormWithRefType; use Nelmio\ApiDocBundle\Tests\Functional\Form\UserType; use OpenApi\Attributes as OA; -use Symfony\Component\HttpKernel\Attribute\MapQueryParameter; -use Symfony\Component\HttpKernel\Attribute\MapQueryString; -use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; use Symfony\Component\Routing\Annotation\Route; class ApiController81 @@ -520,184 +512,4 @@ public function arbitraryArray() public function dictionary() { } - - #[Route('/article_map_query_string')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryString( - #[MapQueryString] SymfonyMapQueryString $article81Query - ) { - } - - #[Route('/article_map_query_string_nullable')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryStringNullable( - #[MapQueryString] ?SymfonyMapQueryString $article81Query - ) { - } - - #[Route('/article_map_query_string_passes_validation_groups')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryStringHandlesValidationGroups( - #[MapQueryString(validationGroups: ['test'])] SymfonyConstraintsWithValidationGroups $symfonyConstraintsWithValidationGroups, - ) { - } - - #[Route('/article_map_query_string_overwrite_parameters')] - #[OA\Parameter( - name: 'id', - in: 'query', - schema: new OA\Schema(type: 'string', nullable: true), - description: 'Query parameter id description' - )] - #[OA\Parameter( - name: 'name', - in: 'query', - description: 'Query parameter name description' - )] - #[OA\Parameter( - name: 'nullableName', - in: 'query', - description: 'Query parameter nullableName description' - )] - #[OA\Parameter( - name: 'articleType81', - in: 'query', - description: 'Query parameter articleType81 description' - )] - #[OA\Parameter( - name: 'nullableArticleType81', - in: 'query', - description: 'Query parameter nullableArticleType81 description' - )] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryStringOverwriteParameters( - #[MapQueryString] SymfonyMapQueryString $article81Query - ) { - } - - #[Route('/article_map_query_string_many_parameters')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleWithManyParameters( - #[MapQueryString] FilterQueryModel $filterQuery, - #[MapQueryString] PaginationQueryModel $paginationQuery, - #[MapQueryString] SortQueryModel $sortQuery, - #[MapQueryString] ArrayQueryModel $arrayQuery, - ) { - } - - #[Route('/article_map_query_string_many_parameters_optional')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleWithManyOptionalParameters( - #[MapQueryString] ?FilterQueryModel $filterQuery, - #[MapQueryString] ?PaginationQueryModel $paginationQuery, - #[MapQueryString] ?SortQueryModel $sortQuery, - #[MapQueryString] ?ArrayQueryModel $arrayQuery, - ) { - } - - #[Route('/article_map_query_parameter')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryParameter( - #[MapQueryParameter] int $someInt, - #[MapQueryParameter] float $someFloat, - #[MapQueryParameter] bool $someBool, - #[MapQueryParameter] string $someString, - #[MapQueryParameter] array $someArray, - ) { - } - - #[Route('/article_map_query_parameter_validate_filters')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryParameterValidateFilters( - #[MapQueryParameter(options: ['min_range' => 2, 'max_range' => 1234])] int $minMaxInt, - #[MapQueryParameter(filter: FILTER_VALIDATE_DOMAIN)] string $domain, - #[MapQueryParameter(filter: FILTER_VALIDATE_EMAIL)] string $email, - #[MapQueryParameter(filter: FILTER_VALIDATE_IP)] string $ip, - #[MapQueryParameter(filter: FILTER_VALIDATE_IP, flags: FILTER_FLAG_IPV4)] string $ipv4, - #[MapQueryParameter(filter: FILTER_VALIDATE_IP, flags: FILTER_FLAG_IPV6)] string $ipv6, - #[MapQueryParameter(filter: FILTER_VALIDATE_MAC)] string $macAddress, - #[MapQueryParameter(filter: FILTER_VALIDATE_REGEXP, options: ['regexp' => '/^test/'])] string $regexp, - #[MapQueryParameter(filter: FILTER_VALIDATE_URL)] string $url, - ) { - } - - #[Route('/article_map_query_parameter_nullable')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryParameterNullable( - #[MapQueryParameter] ?int $id, - ) { - } - - #[Route('/article_map_query_parameter_default')] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryParameterDefault( - #[MapQueryParameter] int $id = 123, - ) { - } - - #[Route('/article_map_query_parameter_overwrite_parameters')] - #[OA\Parameter( - name: 'id', - in: 'query', - description: 'Query parameter id description', - example: 123, - )] - #[OA\Parameter( - name: 'changedType', - in: 'query', - schema: new OA\Schema(type: 'int', nullable: false), - description: 'Incorrectly described query parameter', - example: 123, - )] - #[OA\Response(response: '200', description: '')] - public function fetchArticleFromMapQueryParameterOverwriteParameters( - #[MapQueryParameter] ?int $id, - #[MapQueryParameter] ?string $changedType, - ) { - } - - #[Route('/article_map_request_payload', methods: ['POST'])] - #[OA\Response(response: '200', description: '')] - public function createArticleFromMapRequestPayload( - #[MapRequestPayload] Article81 $article81, - ) { - } - - #[Route('/article_map_request_payload_nullable', methods: ['POST'])] - #[OA\Response(response: '200', description: '')] - public function createArticleFromMapRequestPayloadNullable( - #[MapRequestPayload] ?Article81 $article81, - ) { - } - - #[Route('/article_map_request_payload_overwrite', methods: ['POST'])] - #[OA\RequestBody( - description: 'Request body description', - content: new Model(type: EntityWithNullableSchemaSet::class), - )] - #[OA\Response(response: '200', description: '')] - public function createArticleFromMapRequestPayloadOverwrite( - #[MapRequestPayload] Article81 $article81, - ) { - } - - #[Route('/article_map_request_payload_handles_already_set_content', methods: ['POST'])] - #[OA\RequestBody( - description: 'Request body description', - content: new OA\JsonContent( - ref: new Model(type: Article81::class) - ), - )] - #[OA\Response(response: '200', description: '')] - public function createArticleFromMapRequestPayloadHandlesAlreadySetContent( - #[MapRequestPayload] Article81 $article81, - ) { - } - - #[Route('/article_map_request_payload_validation_groups', methods: ['POST'])] - #[OA\Response(response: '200', description: '')] - public function createArticleFromMapRequestPayloadPassedValidationGroups( - #[MapRequestPayload(validationGroups: ['test'])] SymfonyConstraintsWithValidationGroups $symfonyConstraintsWithValidationGroups, - ) { - } } diff --git a/tests/Functional/Controller/MapQueryParameterController.php b/tests/Functional/Controller/MapQueryParameterController.php new file mode 100644 index 000000000..da4ec9653 --- /dev/null +++ b/tests/Functional/Controller/MapQueryParameterController.php @@ -0,0 +1,79 @@ + 2, 'max_range' => 1234])] int $minMaxInt, + #[MapQueryParameter(filter: FILTER_VALIDATE_DOMAIN)] string $domain, + #[MapQueryParameter(filter: FILTER_VALIDATE_EMAIL)] string $email, + #[MapQueryParameter(filter: FILTER_VALIDATE_IP)] string $ip, + #[MapQueryParameter(filter: FILTER_VALIDATE_IP, flags: FILTER_FLAG_IPV4)] string $ipv4, + #[MapQueryParameter(filter: FILTER_VALIDATE_IP, flags: FILTER_FLAG_IPV6)] string $ipv6, + #[MapQueryParameter(filter: FILTER_VALIDATE_MAC)] string $macAddress, + #[MapQueryParameter(filter: FILTER_VALIDATE_REGEXP, options: ['regexp' => '/^test/'])] string $regexp, + #[MapQueryParameter(filter: FILTER_VALIDATE_URL)] string $url, + ) { + } + + #[Route('/article_map_query_parameter_nullable', methods: ['GET'])] + #[OA\Response(response: '200', description: '')] + public function fetchArticleFromMapQueryParameterNullable( + #[MapQueryParameter] ?int $id, + ) { + } + + #[Route('/article_map_query_parameter_default', methods: ['GET'])] + #[OA\Response(response: '200', description: '')] + public function fetchArticleFromMapQueryParameterDefault( + #[MapQueryParameter] int $id = 123, + ) { + } + + #[Route('/article_map_query_parameter_overwrite_parameters', methods: ['GET'])] + #[OA\Parameter( + name: 'id', + in: 'query', + description: 'Query parameter id description', + example: 123, + )] + #[OA\Parameter( + name: 'changedType', + in: 'query', + schema: new OA\Schema(type: 'int', nullable: false), + description: 'Incorrectly described query parameter', + example: 123, + )] + #[OA\Response(response: '200', description: '')] + public function fetchArticleFromMapQueryParameterOverwriteParameters( + #[MapQueryParameter] ?int $id, + #[MapQueryParameter] ?string $changedType, + ) { + } +} diff --git a/tests/Functional/Controller/MapQueryStringController.php b/tests/Functional/Controller/MapQueryStringController.php index a286cbd23..e08fe8c50 100644 --- a/tests/Functional/Controller/MapQueryStringController.php +++ b/tests/Functional/Controller/MapQueryStringController.php @@ -24,28 +24,28 @@ class MapQueryStringController { - #[Route('/article_map_query_string')] + #[Route('/article_map_query_string', methods: ['GET'])] #[OA\Response(response: '200', description: '')] public function fetchArticleFromMapQueryString( #[MapQueryString] SymfonyMapQueryString $article81Query ) { } - #[Route('/article_map_query_string_nullable')] + #[Route('/article_map_query_string_nullable', methods: ['GET'])] #[OA\Response(response: '200', description: '')] public function fetchArticleFromMapQueryStringNullable( #[MapQueryString] ?SymfonyMapQueryString $article81Query ) { } - #[Route('/article_map_query_string_passes_validation_groups')] + #[Route('/article_map_query_string_passes_validation_groups', methods: ['GET'])] #[OA\Response(response: '200', description: '')] public function fetchArticleFromMapQueryStringHandlesValidationGroups( #[MapQueryString(validationGroups: ['test'])] SymfonyConstraintsWithValidationGroups $symfonyConstraintsWithValidationGroups, ) { } - #[Route('/article_map_query_string_overwrite_parameters')] + #[Route('/article_map_query_string_overwrite_parameters', methods: ['GET'])] #[OA\Parameter( name: 'id', in: 'query', @@ -78,7 +78,7 @@ public function fetchArticleFromMapQueryStringOverwriteParameters( ) { } - #[Route('/article_map_query_string_many_parameters')] + #[Route('/article_map_query_string_many_parameters', methods: ['GET'])] #[OA\Response(response: '200', description: '')] public function fetchArticleWithManyParameters( #[MapQueryString] FilterQueryModel $filterQuery, diff --git a/tests/Functional/Controller/MapRequestPayloadArray.php b/tests/Functional/Controller/MapRequestPayloadArray.php new file mode 100644 index 000000000..5b28066b9 --- /dev/null +++ b/tests/Functional/Controller/MapRequestPayloadArray.php @@ -0,0 +1,33 @@ + $type, ], ]; + + yield 'Symfony 6.3 MapQueryParameter attribute' => [ + [ + 'name' => 'MapQueryParameterController', + 'type' => $type, + ], + ]; + + yield 'Symfony 6.3 MapRequestPayload attribute' => [ + [ + 'name' => 'MapRequestPayloadController', + 'type' => $type, + ], + ]; + + if (property_exists(MapRequestPayload::class, 'type')) { + yield 'Symfony 7.1 MapRequestPayload array type' => [ + [ + 'name' => 'MapRequestPayloadArray', + 'type' => $type, + ], + ]; + } } } diff --git a/tests/Functional/Fixtures/MapQueryParameterController.json b/tests/Functional/Fixtures/MapQueryParameterController.json new file mode 100644 index 000000000..9d626a46a --- /dev/null +++ b/tests/Functional/Fixtures/MapQueryParameterController.json @@ -0,0 +1,229 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "", + "version": "0.0.0" + }, + "paths": { + "/article_map_query_parameter": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapqueryparameter_fetcharticlefrommapqueryparameter", + "parameters": [ + { + "name": "someInt", + "in": "query", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "someFloat", + "in": "query", + "required": true, + "schema": { + "type": "number", + "format": "float" + } + }, + { + "name": "someBool", + "in": "query", + "required": true, + "schema": { + "type": "boolean" + } + }, + { + "name": "someString", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "someArray[]", + "in": "query", + "required": true, + "schema": { + "type": "array", + "items": {} + } + } + ], + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_query_parameter_validate_filters": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapqueryparameter_fetcharticlefrommapqueryparametervalidatefilters", + "parameters": [ + { + "name": "minMaxInt", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "maximum": 1234, + "minimum": 2 + } + }, + { + "name": "domain", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "hostname" + } + }, + { + "name": "email", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "email" + } + }, + { + "name": "ip", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "ip" + } + }, + { + "name": "ipv4", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "ipv4" + } + }, + { + "name": "ipv6", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "ipv6" + } + }, + { + "name": "macAddress", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "mac" + } + }, + { + "name": "regexp", + "in": "query", + "required": true, + "schema": { + "type": "string", + "pattern": "/^test/" + } + }, + { + "name": "url", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + ], + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_query_parameter_nullable": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapqueryparameter_fetcharticlefrommapqueryparameternullable", + "parameters": [ + { + "name": "id", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "nullable": true + } + } + ], + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_query_parameter_default": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapqueryparameter_fetcharticlefrommapqueryparameterdefault", + "parameters": [ + { + "name": "id", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 123 + } + } + ], + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_query_parameter_overwrite_parameters": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapqueryparameter_fetcharticlefrommapqueryparameteroverwriteparameters", + "parameters": [ + { + "name": "id", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "nullable": true + } + }, + { + "name": "changedType", + "in": "query", + "required": false, + "schema": { + "type": "string", + "nullable": true + } + } + ], + "responses": { + "default": { + "description": "" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests/Functional/Fixtures/MapQueryStringCleanupComponents.json b/tests/Functional/Fixtures/MapQueryStringCleanupComponents.json index 50216f72b..dd8152e8d 100644 --- a/tests/Functional/Fixtures/MapQueryStringCleanupComponents.json +++ b/tests/Functional/Fixtures/MapQueryStringCleanupComponents.json @@ -61,70 +61,16 @@ "description": "" } } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", + } + }, + "/article_map_query_string_nullable": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", "parameters": [ { "name": "id", "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, "schema": { "type": "integer" } @@ -132,63 +78,7 @@ { "name": "name", "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, "schema": { "type": "string" } @@ -205,63 +95,7 @@ { "name": "articleType81", "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, "schema": { "$ref": "#/components/schemas/ArticleType81" } @@ -285,54 +119,41 @@ "description": "" } } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", + } + }, + "/article_map_query_string_passes_validation_groups": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", "parameters": [ { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", + "name": "property", "in": "query", "required": true, "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true + "type": "integer", + "maximum": 100, + "minimum": 1 } }, { - "name": "articleType81", + "name": "propertyInDefaultGroup", "in": "query", "required": true, "schema": { - "$ref": "#/components/schemas/ArticleType81" + "type": "integer", + "maximum": 100, + "minimum": 1 } }, { - "name": "nullableArticleType81", + "name": "propertyArray[]", "in": "query", "required": false, "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] + "type": "array", + "items": { + "type": "string" + } } } ], @@ -341,65 +162,11 @@ "description": "" } } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", + } + }, + "/article_map_query_string_overwrite_parameters": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", "parameters": [ { "name": "id", @@ -455,1862 +222,9 @@ } } }, - "/article_map_query_string_nullable": { + "/article_map_query_string_many_parameters": { "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - } - }, - "/article_map_query_string_passes_validation_groups": { - "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - } - }, - "/article_map_query_string_overwrite_parameters": { - "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - } - }, - "/article_map_query_string_many_parameters": { - "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", "parameters": [ { "name": "filter", diff --git a/tests/Functional/Fixtures/MapQueryStringController.json b/tests/Functional/Fixtures/MapQueryStringController.json index 082767c50..2dae21ab6 100644 --- a/tests/Functional/Fixtures/MapQueryStringController.json +++ b/tests/Functional/Fixtures/MapQueryStringController.json @@ -61,70 +61,16 @@ "description": "" } } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", + } + }, + "/article_map_query_string_nullable": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", "parameters": [ { "name": "id", "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, "schema": { "type": "integer" } @@ -132,63 +78,7 @@ { "name": "name", "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, "schema": { "type": "string" } @@ -205,63 +95,7 @@ { "name": "articleType81", "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, "schema": { "$ref": "#/components/schemas/ArticleType81" } @@ -285,54 +119,41 @@ "description": "" } } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", + } + }, + "/article_map_query_string_passes_validation_groups": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", "parameters": [ { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", + "name": "property", "in": "query", "required": true, "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true + "type": "integer", + "maximum": 100, + "minimum": 1 } }, { - "name": "articleType81", + "name": "propertyInDefaultGroup", "in": "query", "required": true, "schema": { - "$ref": "#/components/schemas/ArticleType81" + "type": "integer", + "maximum": 100, + "minimum": 1 } }, { - "name": "nullableArticleType81", + "name": "propertyArray[]", "in": "query", "required": false, "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] + "type": "array", + "items": { + "type": "string" + } } } ], @@ -341,65 +162,11 @@ "description": "" } } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystring", + } + }, + "/article_map_query_string_overwrite_parameters": { + "get": { + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", "parameters": [ { "name": "id", @@ -455,1862 +222,9 @@ } } }, - "/article_map_query_string_nullable": { + "/article_map_query_string_many_parameters": { "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringnullable", - "parameters": [ - { - "name": "id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - } - }, - "/article_map_query_string_passes_validation_groups": { - "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringhandlesvalidationgroups", - "parameters": [ - { - "name": "property", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyInDefaultGroup", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1 - } - }, - { - "name": "propertyArray[]", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - } - }, - "/article_map_query_string_overwrite_parameters": { - "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlefrommapquerystringoverwriteparameters", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "name", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "nullableName", - "in": "query", - "required": false, - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "articleType81", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/ArticleType81" - } - }, - { - "name": "nullableArticleType81", - "in": "query", - "required": false, - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ArticleType81" - } - ] - } - } - ], - "responses": { - "default": { - "description": "" - } - } - } - }, - "/article_map_query_string_many_parameters": { - "get": { - "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "put": { - "operationId": "put_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "post": { - "operationId": "post_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "delete": { - "operationId": "delete_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "options": { - "operationId": "options_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "head": { - "operationId": "head_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "patch": { - "operationId": "patch_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", - "parameters": [ - { - "name": "filter", - "in": "query", - "required": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - } - }, - { - "name": "filterBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "offset", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 10 - } - }, - { - "name": "sortBy", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "orderBy", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/SortEnum" - } - }, - { - "name": "ids[]", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": {} - } - }, - { - "name": "productIds[]", - "in": "query", - "description": "List of product ids", - "required": false, - "schema": { - "description": "List of product ids", - "type": "array", - "items": { - "type": "integer" - } - } - } - ], - "responses": { - "default": { - "description": "" - } - } - }, - "trace": { - "operationId": "trace_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", + "operationId": "get_nelmio_apidoc_tests_functional_mapquerystring_fetcharticlewithmanyparameters", "parameters": [ { "name": "filter", diff --git a/tests/Functional/Fixtures/MapRequestPayloadArray.json b/tests/Functional/Fixtures/MapRequestPayloadArray.json new file mode 100644 index 000000000..afbdb221f --- /dev/null +++ b/tests/Functional/Fixtures/MapRequestPayloadArray.json @@ -0,0 +1,116 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "", + "version": "0.0.0" + }, + "paths": { + "/article_map_request_payload_array": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayloadarray_createarticlefrommaprequestpayloadarray", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Article81" + } + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_request_payload_nullable_array": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayloadarray_createarticlefrommaprequestpayloadnullablearray", + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Article81" + }, + "nullable": true + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + } + }, + "components": { + "schemas": { + "Article81": { + "required": [ + "id", + "type", + "intBackedType", + "notBackedType" + ], + "properties": { + "id": { + "type": "integer" + }, + "type": { + "$ref": "#/components/schemas/ArticleType81" + }, + "intBackedType": { + "$ref": "#/components/schemas/ArticleType81IntBacked" + }, + "notBackedType": { + "$ref": "#/components/schemas/ArticleType81NotBacked" + }, + "nullableType": { + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ArticleType81" + } + ] + } + }, + "type": "object" + }, + "ArticleType81": { + "type": "string", + "enum": [ + "draft", + "final" + ] + }, + "ArticleType81IntBacked": { + "type": "integer", + "enum": [ + 0, + 1 + ] + }, + "ArticleType81NotBacked": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "type": "object" + } + } + } +} \ No newline at end of file diff --git a/tests/Functional/Fixtures/MapRequestPayloadController.json b/tests/Functional/Fixtures/MapRequestPayloadController.json new file mode 100644 index 000000000..139309ced --- /dev/null +++ b/tests/Functional/Fixtures/MapRequestPayloadController.json @@ -0,0 +1,199 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "", + "version": "0.0.0" + }, + "paths": { + "/article_map_request_payload": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayload_createarticlefrommaprequestpayload", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Article81" + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_request_payload_nullable": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayload_createarticlefrommaprequestpayloadnullable", + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/Article81" + } + ], + "nullable": true + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_request_payload_overwrite": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayload_createarticlefrommaprequestpayloadoverwrite", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Article81" + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_request_payload_handles_already_set_content": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayload_createarticlefrommaprequestpayloadhandlesalreadysetcontent", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Article81" + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + }, + "/article_map_request_payload_validation_groups": { + "post": { + "operationId": "post_nelmio_apidoc_tests_functional_maprequestpayload_createarticlefrommaprequestpayloadpassedvalidationgroups", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SymfonyConstraintsWithValidationGroups" + } + } + } + }, + "responses": { + "default": { + "description": "" + } + } + } + } + }, + "components": { + "schemas": { + "Article81": { + "required": [ + "id", + "type", + "intBackedType", + "notBackedType" + ], + "properties": { + "id": { + "type": "integer" + }, + "type": { + "$ref": "#/components/schemas/ArticleType81" + }, + "intBackedType": { + "$ref": "#/components/schemas/ArticleType81IntBacked" + }, + "notBackedType": { + "$ref": "#/components/schemas/ArticleType81NotBacked" + }, + "nullableType": { + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ArticleType81" + } + ] + } + }, + "type": "object" + }, + "SymfonyConstraintsWithValidationGroups": { + "required": [ + "property", + "propertyInDefaultGroup" + ], + "properties": { + "property": { + "type": "integer", + "maximum": 100, + "minimum": 1 + }, + "propertyInDefaultGroup": { + "type": "integer", + "maximum": 100, + "minimum": 1 + }, + "propertyArray": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "type": "object" + }, + "ArticleType81": { + "type": "string", + "enum": [ + "draft", + "final" + ] + }, + "ArticleType81IntBacked": { + "type": "integer", + "enum": [ + 0, + 1 + ] + }, + "ArticleType81NotBacked": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "type": "object" + } + } + } +} \ No newline at end of file diff --git a/tests/Functional/SymfonyFunctionalTest.php b/tests/Functional/SymfonyFunctionalTest.php deleted file mode 100644 index 61db0c600..000000000 --- a/tests/Functional/SymfonyFunctionalTest.php +++ /dev/null @@ -1,833 +0,0 @@ - 'api.example.com']); - } - - public function testMapQueryStringModelGetsCreated(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - $expected = [ - 'schema' => 'SymfonyMapQueryString', - 'required' => [ - 'id', - 'name', - 'articleType81', - ], - 'properties' => [ - 'id' => [ - 'type' => 'integer', - ], - 'name' => [ - 'type' => 'string', - ], - 'nullableName' => [ - 'type' => 'string', - 'nullable' => true, - ], - 'articleType81' => [ - '$ref' => '#/components/schemas/ArticleType81', - ], - 'nullableArticleType81' => [ - 'nullable' => true, - 'oneOf' => [ - ['$ref' => '#/components/schemas/ArticleType81'], - ], - ], - ], - 'type' => 'object', - ]; - - self::assertSame($expected, json_decode($this->getModel('SymfonyMapQueryString')->toJson(), true)); - } - - public function testMapQueryString(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'get_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapquerystring', - 'parameters' => [ - [ - 'name' => 'id', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'integer', - ], - ], - [ - 'name' => 'name', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'nullableName', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'string', - 'nullable' => true, - ], - ], - [ - 'name' => 'articleType81', - 'in' => 'query', - 'required' => true, - 'schema' => [ - '$ref' => '#/components/schemas/ArticleType81', - ], - ], - [ - 'name' => 'nullableArticleType81', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'nullable' => true, - 'oneOf' => [ - ['$ref' => '#/components/schemas/ArticleType81'], - ], - ], - ], - ], - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_string', 'get')->toJson(), true)); - } - - public function testMapQueryStringParametersAreOptional(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'get_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapquerystringnullable', - 'parameters' => [ - [ - 'name' => 'id', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - ], - ], - [ - 'name' => 'name', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'nullableName', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'string', - 'nullable' => true, - ], - ], - [ - 'name' => 'articleType81', - 'in' => 'query', - 'required' => false, - 'schema' => [ - '$ref' => '#/components/schemas/ArticleType81', - ], - ], - [ - 'name' => 'nullableArticleType81', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'nullable' => true, - 'oneOf' => [ - ['$ref' => '#/components/schemas/ArticleType81'], - ], - ], - ], - ], - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_string_nullable', 'get')->toJson(), true)); - } - - public function testMapQueryStringParametersOverwriteParameters(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'get_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapquerystringoverwriteparameters', - 'parameters' => [ - [ - 'name' => 'id', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'nullable' => true, - ], - 'description' => 'Query parameter id description', - ], - [ - 'name' => 'name', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - ], - 'description' => 'Query parameter name description', - ], - [ - 'name' => 'nullableName', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'string', - 'nullable' => true, - ], - 'description' => 'Query parameter nullableName description', - ], - [ - 'name' => 'articleType81', - 'in' => 'query', - 'required' => true, - 'schema' => [ - '$ref' => '#/components/schemas/ArticleType81', - ], - 'description' => 'Query parameter articleType81 description', - ], - [ - 'name' => 'nullableArticleType81', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'nullable' => true, - 'oneOf' => [ - ['$ref' => '#/components/schemas/ArticleType81'], - ], - ], - 'description' => 'Query parameter nullableArticleType81 description', - ], - ], - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_string_overwrite_parameters', 'get')->toJson(), true)); - } - - public function testMapQueryParameter(): void - { - if (!class_exists(MapQueryParameter::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryParameter attribute not found'); - } - - self::assertEquals([ - [ - 'name' => 'someInt', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'integer', - ], - ], - [ - 'name' => 'someFloat', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'number', - 'format' => 'float', - ], - ], - [ - 'name' => 'someBool', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'boolean', - ], - ], - [ - 'name' => 'someString', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'someArray[]', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'array', - 'items' => [], - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_parameter', 'get')->toJson(), true)['parameters']); - } - - public function testMapQueryParameterHandlesNullable(): void - { - if (!class_exists(MapQueryParameter::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryParameter attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'get_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapqueryparameternullable', - 'parameters' => [ - [ - 'name' => 'id', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'nullable' => true, - ], - ], - ], - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_parameter_nullable', 'get')->toJson(), true)); - } - - public function testMapQueryParameterHandlesDefault(): void - { - if (!class_exists(MapQueryParameter::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryParameter attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'get_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapqueryparameterdefault', - 'parameters' => [ - [ - 'name' => 'id', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'default' => 123, - ], - ], - ], - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_parameter_default', 'get')->toJson(), true)); - } - - public function testMapQueryParameterOverwriteParameter(): void - { - if (!class_exists(MapQueryParameter::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryParameter attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'get_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapqueryparameteroverwriteparameters', - 'parameters' => [ - [ - 'name' => 'id', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'nullable' => true, - ], - 'description' => 'Query parameter id description', - 'example' => 123, - ], - [ - 'name' => 'changedType', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'int', - 'nullable' => false, - ], - 'description' => 'Incorrectly described query parameter', - 'example' => 123, - ], - ], - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_parameter_overwrite_parameters', 'get')->toJson(), true)); - } - - public function testMapRequestPayload(): void - { - if (!class_exists(MapRequestPayload::class)) { - self::markTestSkipped('Symfony 6.3 MapRequestPayload attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'post_api_nelmio_apidoc_tests_functional_api_createarticlefrommaprequestpayload', - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - 'requestBody' => [ - 'content' => [ - 'application/json' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Article81', - ], - ], - ], - 'required' => true, - ], - ], json_decode($this->getOperation('/api/article_map_request_payload', 'post')->toJson(), true)); - } - - public function testMapRequestPayloadNullable(): void - { - if (!class_exists(MapRequestPayload::class)) { - self::markTestSkipped('Symfony 6.3 MapRequestPayload attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'post_api_nelmio_apidoc_tests_functional_api_createarticlefrommaprequestpayloadnullable', - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - 'requestBody' => [ - 'content' => [ - 'application/json' => [ - 'schema' => [ - 'nullable' => true, - 'oneOf' => [ - ['$ref' => '#/components/schemas/Article81'], - ], - ], - ], - ], - 'required' => false, - ], - ], json_decode($this->getOperation('/api/article_map_request_payload_nullable', 'post')->toJson(), true)); - } - - public function testMapRequestPayloadOverwriteRequestBody(): void - { - if (!class_exists(MapRequestPayload::class)) { - self::markTestSkipped('Symfony 6.3 MapRequestPayload attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'post_api_nelmio_apidoc_tests_functional_api_createarticlefrommaprequestpayloadoverwrite', - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - 'requestBody' => [ - 'content' => [ - 'application/json' => [ - 'schema' => [ - '$ref' => '#/components/schemas/EntityWithNullableSchemaSet', - ], - ], - ], - 'required' => true, - 'description' => 'Request body description', - ], - ], json_decode($this->getOperation('/api/article_map_request_payload_overwrite', 'post')->toJson(), true)); - } - - public function testMapRequestPayloadHandlesAlreadySetContent(): void - { - if (!class_exists(MapRequestPayload::class)) { - self::markTestSkipped('Symfony 6.3 MapRequestPayload attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'post_api_nelmio_apidoc_tests_functional_api_createarticlefrommaprequestpayloadhandlesalreadysetcontent', - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - 'requestBody' => [ - 'content' => [ - 'application/json' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Article81', - ], - ], - ], - 'required' => true, - 'description' => 'Request body description', - ], - ], json_decode($this->getOperation('/api/article_map_request_payload_handles_already_set_content', 'post')->toJson(), true)); - } - - public function testMapRequestPayloadPassesValidationGroups(): void - { - if (!class_exists(MapRequestPayload::class)) { - self::markTestSkipped('Symfony 6.3 MapRequestPayload attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'post_api_nelmio_apidoc_tests_functional_api_createarticlefrommaprequestpayloadpassedvalidationgroups', - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - 'requestBody' => [ - 'content' => [ - 'application/json' => [ - 'schema' => [ - '$ref' => '#/components/schemas/SymfonyConstraintsTestGroup', - ], - ], - ], - 'required' => true, - ], - ], json_decode($this->getOperation('/api/article_map_request_payload_validation_groups', 'post')->toJson(), true)); - } - - public function testMapQueryStringPassesValidationGroups(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - self::assertEquals([ - 'operationId' => 'post_api_nelmio_apidoc_tests_functional_api_fetcharticlefrommapquerystringhandlesvalidationgroups', - 'responses' => [ - '200' => [ - 'description' => '', - ], - ], - 'parameters' => [ - [ - 'name' => 'property', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'integer', - 'maximum' => 100, - 'minimum' => 1, - ], - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_string_passes_validation_groups', 'post')->toJson(), true)); - } - - public function testMapQueryStringHandlesManyParameters(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - self::assertEquals([ - [ - 'name' => 'filter', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'oneOf' => [ - ['type' => 'string'], - ['type' => 'integer'], - ], - ], - ], - [ - 'name' => 'filterBy', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'offset', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'default' => 0, - ], - ], - [ - 'name' => 'limit', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'default' => 10, - ], - ], - [ - 'name' => 'sortBy', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'orderBy', - 'in' => 'query', - 'required' => false, - 'schema' => [ - '$ref' => '#/components/schemas/SortEnum', - ], - ], - [ - 'name' => 'ids[]', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'array', - 'items' => [], - ], - ], - [ - 'name' => 'productIds[]', - 'in' => 'query', - 'required' => false, - 'description' => 'List of product ids', - 'schema' => [ - 'type' => 'array', - 'description' => 'List of product ids', - 'items' => [ - 'type' => 'integer', - ], - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_string_many_parameters', 'get')->toJson(), true)['parameters']); - } - - public function testMapQueryStringHandlesManyParametersOptional(): void - { - if (!class_exists(MapQueryString::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryString attribute not found'); - } - - self::assertEquals([ - [ - 'name' => 'filter', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'oneOf' => [ - ['type' => 'string'], - ['type' => 'integer'], - ], - ], - ], - [ - 'name' => 'filterBy', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'offset', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'default' => 0, - ], - ], - [ - 'name' => 'limit', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'integer', - 'default' => 10, - ], - ], - [ - 'name' => 'sortBy', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'string', - ], - ], - [ - 'name' => 'orderBy', - 'in' => 'query', - 'required' => false, - 'schema' => [ - '$ref' => '#/components/schemas/SortEnum', - ], - ], - [ - 'name' => 'ids[]', - 'in' => 'query', - 'required' => false, - 'schema' => [ - 'type' => 'array', - 'items' => [], - ], - ], - [ - 'name' => 'productIds[]', - 'in' => 'query', - 'required' => false, - 'description' => 'List of product ids', - 'schema' => [ - 'type' => 'array', - 'description' => 'List of product ids', - 'items' => [ - 'type' => 'integer', - ], - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_string_many_parameters_optional', 'get')->toJson(), true)['parameters']); - } - - public function testMapQueryParameterHandlesValidateFilters(): void - { - if (!class_exists(MapQueryParameter::class)) { - self::markTestSkipped('Symfony 6.3 MapQueryParameter attribute not found'); - } - - self::assertEquals([ - [ - 'name' => 'minMaxInt', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'integer', - 'minimum' => 2, - 'maximum' => 1234, - ], - ], - [ - 'name' => 'domain', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'hostname', - ], - ], - [ - 'name' => 'email', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'email', - ], - ], - [ - 'name' => 'ip', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'ip', - ], - ], - [ - 'name' => 'ipv4', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'ipv4', - ], - ], - [ - 'name' => 'ipv6', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'ipv6', - ], - ], - [ - 'name' => 'macAddress', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'mac', - ], - ], - [ - 'name' => 'regexp', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'pattern' => '/^test/', - ], - ], - [ - 'name' => 'url', - 'in' => 'query', - 'required' => true, - 'schema' => [ - 'type' => 'string', - 'format' => 'uri', - ], - ], - ], json_decode($this->getOperation('/api/article_map_query_parameter_validate_filters', 'get')->toJson(), true)['parameters']); - } -} diff --git a/tests/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriberTest.php b/tests/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriberTest.php new file mode 100644 index 000000000..613a2ea18 --- /dev/null +++ b/tests/RouteDescriber/RouteArgumentDescriber/SymfonyMapRequestPayloadDescriberTest.php @@ -0,0 +1,77 @@ +hasProperty('type')) { + self::markTestSkipped('Requires Symfony 7.1'); + } + + $registry = new ModelRegistry( + [$this->createMock(ModelDescriberInterface::class)], + $this->createMock(OpenApi::class), + ); + $describer = new SymfonyMapRequestPayloadDescriber(); + $describer->setModelRegistry($registry); + + $argumentData = new ArgumentMetadata( + 'someObjects', + Type::BUILTIN_TYPE_ARRAY, + false, + false, + null, + false, + [ + /* @phpstan-ignore-next-line can be removed with Symfony 7.1 integration */ + new MapRequestPayload( + null, + [], + null, + RequestPayloadValueResolver::class, + Response::HTTP_UNPROCESSABLE_ENTITY, + SomeObject::class + ), + ] + ); + + $operation = $this->createMock(Operation::class); + $operation->_context = new Context(); + + $describer->describe($argumentData, $operation); + + self::assertSame('#/components/schemas/SomeObject', $operation->_context->{SymfonyMapRequestPayloadDescriber::CONTEXT_MODEL_REF}); + } +} diff --git a/tests/RouteDescriber/RouteArgumentDescriber/fixture/SomeObject.php b/tests/RouteDescriber/RouteArgumentDescriber/fixture/SomeObject.php new file mode 100644 index 000000000..3a4f256fe --- /dev/null +++ b/tests/RouteDescriber/RouteArgumentDescriber/fixture/SomeObject.php @@ -0,0 +1,18 @@ +