diff --git a/features/openapi/docs.feature b/features/openapi/docs.feature index 5d5d802c1dc..dd32e4fa377 100644 --- a/features/openapi/docs.feature +++ b/features/openapi/docs.feature @@ -108,13 +108,13 @@ Feature: Documentation support #And the "isDummyBoolean" property exists for the OpenAPI class "DummyBoolean" #And the "isDummyBoolean" property is not read only for the OpenAPI class "DummyBoolean" # Filters - And the JSON node "paths./dummies.get.parameters[3].name" should be equal to "dummyBoolean" - And the JSON node "paths./dummies.get.parameters[3].in" should be equal to "query" - And the JSON node "paths./dummies.get.parameters[3].required" should be false - And the JSON node "paths./dummies.get.parameters[3].schema.type" should be equal to "boolean" + And the JSON node "paths./dummies.get.parameters[4].name" should be equal to "dummyBoolean" + And the JSON node "paths./dummies.get.parameters[4].in" should be equal to "query" + And the JSON node "paths./dummies.get.parameters[4].required" should be false + And the JSON node "paths./dummies.get.parameters[4].schema.type" should be equal to "boolean" - And the JSON node "paths./dummy_cars.get.parameters[8].name" should be equal to "foobar[]" - And the JSON node "paths./dummy_cars.get.parameters[8].description" should be equal to "Allows you to reduce the response to contain only the properties you need. If your desired property is nested, you can address it using nested arrays. Example: foobar[]={propertyName}&foobar[]={anotherPropertyName}&foobar[{nestedPropertyParent}][]={nestedProperty}" + And the JSON node "paths./dummy_cars.get.parameters[9].name" should be equal to "foobar[]" + And the JSON node "paths./dummy_cars.get.parameters[9].description" should be equal to "Allows you to reduce the response to contain only the properties you need. If your desired property is nested, you can address it using nested arrays. Example: foobar[]={propertyName}&foobar[]={anotherPropertyName}&foobar[{nestedPropertyParent}][]={nestedProperty}" # Webhook And the JSON node "webhooks.a.get.description" should be equal to "Something else here for example" @@ -141,16 +141,16 @@ Feature: Documentation support And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[3].required" should be false And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[3].schema.type" should be equal to "boolean" - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[4].name" should be equal to "name" - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[4].in" should be equal to "query" - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[4].required" should be false - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[4].schema.type" should be equal to "string" - - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[5].name" should be equal to "description" + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[5].name" should be equal to "name" And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[5].in" should be equal to "query" And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[5].required" should be false + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[5].schema.type" should be equal to "string" + + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[6].name" should be equal to "description" + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[6].in" should be equal to "query" + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[6].required" should be false - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters" should have 6 elements + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters" should have 7 elements # Subcollection - check schema And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend.jsonld-fakemanytomany" diff --git a/src/OpenApi/Factory/OpenApiFactory.php b/src/OpenApi/Factory/OpenApiFactory.php index 2d98643ea99..1b943c96008 100644 --- a/src/OpenApi/Factory/OpenApiFactory.php +++ b/src/OpenApi/Factory/OpenApiFactory.php @@ -755,6 +755,10 @@ private function getPaginationParameters(CollectionOperationInterface|HttpOperat $parameters[] = new Parameter($this->paginationOptions->getPaginationClientEnabledParameterName(), 'query', 'Enable or disable pagination', false, false, true, ['type' => 'boolean']); } + if ($operation->getPaginationClientPartial() ?? $this->paginationOptions->isClientPartialPaginationEnabled()) { + $parameters[] = new Parameter($this->paginationOptions->getPartialPaginationParameterName(), 'query', 'Enable or disable partial pagination', false, false, true, ['type' => 'boolean']); + } + return $parameters; } diff --git a/src/OpenApi/Tests/Factory/OpenApiFactoryTest.php b/src/OpenApi/Tests/Factory/OpenApiFactoryTest.php index 2f938a94e31..d44c3d78d57 100644 --- a/src/OpenApi/Tests/Factory/OpenApiFactoryTest.php +++ b/src/OpenApi/Tests/Factory/OpenApiFactoryTest.php @@ -182,6 +182,7 @@ public function testInvoke(): void 'paginatedDummyCollection' => (new GetCollection())->withUriTemplate('/paginated') ->withPaginationClientEnabled(true) ->withPaginationClientItemsPerPage(true) + ->withPaginationClientPartial(true) ->withPaginationItemsPerPage(20) ->withPaginationMaximumItemsPerPage(80) ->withOperation($baseOperation), @@ -994,6 +995,9 @@ public function testInvoke(): void new Parameter('pagination', 'query', 'Enable or disable pagination', false, false, true, [ 'type' => 'boolean', ]), + new Parameter('partial', 'query', 'Enable or disable partial pagination', false, false, true, [ + 'type' => 'boolean', + ]), ] ), $paginatedPath->getGet());