From a55cf2526a3144babd638c6979708d3816e69e06 Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Sat, 18 Sep 2021 17:41:09 +0200 Subject: [PATCH 1/6] Fix handling multi pagination type for same resource --- src/GraphQl/Type/TypeBuilder.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/GraphQl/Type/TypeBuilder.php b/src/GraphQl/Type/TypeBuilder.php index 68bc15b736c..ad4b073ffc4 100644 --- a/src/GraphQl/Type/TypeBuilder.php +++ b/src/GraphQl/Type/TypeBuilder.php @@ -224,25 +224,24 @@ public function getNodeInterface(): InterfaceType public function getResourcePaginatedCollectionType(GraphQLType $resourceType, string $resourceClass, string $operationName): GraphQLType { $shortName = $resourceType->name; + $paginationType = $this->pagination->getGraphQlPaginationType($resourceClass, $operationName); - if ($this->typesContainer->has("{$shortName}Connection")) { - return $this->typesContainer->get("{$shortName}Connection"); + if ($this->typesContainer->has("{$shortName}Connection_{$paginationType}")) { + return $this->typesContainer->get("{$shortName}Connection_{$paginationType}"); } - $paginationType = $this->pagination->getGraphQlPaginationType($resourceClass, $operationName); - $fields = 'cursor' === $paginationType ? $this->getCursorBasedPaginationFields($resourceType) : $this->getPageBasedPaginationFields($resourceType); $configuration = [ - 'name' => "{$shortName}Connection", - 'description' => "Connection for $shortName.", + 'name' => "{$shortName}Connection_{$paginationType}", + 'description' => "Connection for $shortName. ({$paginationType})", 'fields' => $fields, ]; $resourcePaginatedCollectionType = new ObjectType($configuration); - $this->typesContainer->set("{$shortName}Connection", $resourcePaginatedCollectionType); + $this->typesContainer->set("{$shortName}Connection_{$paginationType}", $resourcePaginatedCollectionType); return $resourcePaginatedCollectionType; } From 837dee73f3cd5ae340c084069fe131bd31a5e05c Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Sat, 18 Sep 2021 19:18:01 +0200 Subject: [PATCH 2/6] Fix tests --- tests/GraphQl/Type/TypeBuilderTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/GraphQl/Type/TypeBuilderTest.php b/tests/GraphQl/Type/TypeBuilderTest.php index 19b0feaaaaa..9b20dbee1f0 100644 --- a/tests/GraphQl/Type/TypeBuilderTest.php +++ b/tests/GraphQl/Type/TypeBuilderTest.php @@ -472,8 +472,8 @@ public function testGetNodeInterface(): void public function testCursorBasedGetResourcePaginatedCollectionType(): void { - $this->typesContainerProphecy->has('StringConnection')->shouldBeCalled()->willReturn(false); - $this->typesContainerProphecy->set('StringConnection', Argument::type(ObjectType::class))->shouldBeCalled(); + $this->typesContainerProphecy->has('StringConnection_cursor')->shouldBeCalled()->willReturn(false); + $this->typesContainerProphecy->set('StringConnection_cursor', Argument::type(ObjectType::class))->shouldBeCalled(); $this->typesContainerProphecy->set('StringEdge', Argument::type(ObjectType::class))->shouldBeCalled(); $this->typesContainerProphecy->set('StringPageInfo', Argument::type(ObjectType::class))->shouldBeCalled(); $this->resourceMetadataCollectionFactoryProphecy->create('StringResourceClass')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('StringResourceClass', [ @@ -484,8 +484,8 @@ public function testCursorBasedGetResourcePaginatedCollectionType(): void /** @var ObjectType $resourcePaginatedCollectionType */ $resourcePaginatedCollectionType = $this->typeBuilder->getResourcePaginatedCollectionType(GraphQLType::string(), 'StringResourceClass', 'operationName'); - $this->assertSame('StringConnection', $resourcePaginatedCollectionType->name); - $this->assertSame('Connection for String.', $resourcePaginatedCollectionType->description); + $this->assertSame('StringConnection_cursor', $resourcePaginatedCollectionType->name); + $this->assertSame('Connection for String. (cursor)', $resourcePaginatedCollectionType->description); $resourcePaginatedCollectionTypeFields = $resourcePaginatedCollectionType->getFields(); $this->assertArrayHasKey('edges', $resourcePaginatedCollectionTypeFields); @@ -531,8 +531,8 @@ public function testCursorBasedGetResourcePaginatedCollectionType(): void public function testPageBasedGetResourcePaginatedCollectionType(): void { - $this->typesContainerProphecy->has('StringConnection')->shouldBeCalled()->willReturn(false); - $this->typesContainerProphecy->set('StringConnection', Argument::type(ObjectType::class))->shouldBeCalled(); + $this->typesContainerProphecy->has('StringConnection_page')->shouldBeCalled()->willReturn(false); + $this->typesContainerProphecy->set('StringConnection_page', Argument::type(ObjectType::class))->shouldBeCalled(); $this->typesContainerProphecy->set('StringPaginationInfo', Argument::type(ObjectType::class))->shouldBeCalled(); $this->resourceMetadataCollectionFactoryProphecy->create('StringResourceClass')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('StringResourceClass', [ @@ -543,8 +543,8 @@ public function testPageBasedGetResourcePaginatedCollectionType(): void /** @var ObjectType $resourcePaginatedCollectionType */ $resourcePaginatedCollectionType = $this->typeBuilder->getResourcePaginatedCollectionType(GraphQLType::string(), 'StringResourceClass', 'operationName'); - $this->assertSame('StringConnection', $resourcePaginatedCollectionType->name); - $this->assertSame('Connection for String.', $resourcePaginatedCollectionType->description); + $this->assertSame('StringConnection_page', $resourcePaginatedCollectionType->name); + $this->assertSame('Connection for String. (page)', $resourcePaginatedCollectionType->description); $resourcePaginatedCollectionTypeFields = $resourcePaginatedCollectionType->getFields(); $this->assertArrayHasKey('collection', $resourcePaginatedCollectionTypeFields); From 164e0e3807abb3c47d49a8c1ba4acdc0cbe23225 Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Sat, 18 Sep 2021 20:11:12 +0200 Subject: [PATCH 3/6] fix tests --- features/graphql/collection.feature | 2 +- features/graphql/introspection.feature | 10 +++++----- features/graphql/mutation.feature | 2 +- features/graphql/schema.feature | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/features/graphql/collection.feature b/features/graphql/collection.feature index cf5b7a1fbc7..39cc21e9a8f 100644 --- a/features/graphql/collection.feature +++ b/features/graphql/collection.feature @@ -9,7 +9,7 @@ Feature: GraphQL collection support ...dummyFields } } - fragment dummyFields on DummyConnection { + fragment dummyFields on DummyConnection_cursor { edges { node { id diff --git a/features/graphql/introspection.feature b/features/graphql/introspection.feature index d1923c738c2..b23cdb6522b 100644 --- a/features/graphql/introspection.feature +++ b/features/graphql/introspection.feature @@ -37,7 +37,7 @@ Feature: GraphQL introspection support } } } - type2: __type(name: "DummyAggregateOfferConnection") { + type2: __type(name: "DummyAggregateOfferConnection_cursor") { description, fields { name @@ -76,7 +76,7 @@ Feature: GraphQL introspection support { "name":"offers", "type":{ - "name":"DummyAggregateOfferConnection", + "name":"DummyAggregateOfferConnection_cursor", "kind":"OBJECT", "ofType":null } @@ -546,7 +546,7 @@ Feature: GraphQL introspection support When I send the following GraphQL request: """ { - typeNotAvailable: __type(name: "VoDummyInspectionConnection") { + typeNotAvailable: __type(name: "VoDummyInspectionConnection_cursor") { description } typeOwner: __type(name: "VoDummyCar") { @@ -563,6 +563,6 @@ Feature: GraphQL introspection support Then the response status code should be 200 And the response should be in JSON And the header "Content-Type" should be equal to "application/json" - And the JSON node "errors[0].debugMessage" should be equal to 'Type with id "VoDummyInspectionConnection" is not present in the types container' + And the JSON node "errors[0].debugMessage" should be equal to 'Type with id "VoDummyInspectionConnection_cursor" is not present in the types container' And the JSON node "data.typeNotAvailable" should be null - And the JSON node "data.typeOwner.fields[3].type.name" should be equal to "VoDummyInspectionConnection" + And the JSON node "data.typeOwner.fields[3].type.name" should be equal to "VoDummyInspectionConnection_cursor" diff --git a/features/graphql/mutation.feature b/features/graphql/mutation.feature index 0bb5caf44eb..63463a070e9 100644 --- a/features/graphql/mutation.feature +++ b/features/graphql/mutation.feature @@ -709,7 +709,7 @@ Feature: GraphQL mutation support And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.__typename" should be equal to "updateThirdLevelNestedPayload" And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.fourthLevel.id" should be equal to "/fourth_levels/1" And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.fourthLevel.__typename" should be equal to "updateFourthLevelNestedPayload" - And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.__typename" should be equal to "updateRelatedToDummyFriendNestedPayloadConnection" + And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.__typename" should be equal to "updateRelatedToDummyFriendNestedPayloadConnection_cursor" And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.edges[0].node.name" should be equal to "Relation-1" And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.edges[1].node.name" should be equal to "Relation-2" diff --git a/features/graphql/schema.feature b/features/graphql/schema.feature index 75f63b9a59a..a09a3b4487e 100644 --- a/features/graphql/schema.feature +++ b/features/graphql/schema.feature @@ -16,8 +16,8 @@ Feature: GraphQL schema-related features name: String! } - ###Connection for DummyFriend.### - type DummyFriendConnection { + ###Connection for DummyFriend. (cursor)### + type DummyFriendConnection_cursor { edges: [DummyFriendEdge] pageInfo: DummyFriendPageInfo! totalCount: Int! @@ -54,8 +54,8 @@ Feature: GraphQL schema-related features name: String! } - # Connection for DummyFriend. - type DummyFriendConnection { + # Connection for DummyFriend. (cursor) + type DummyFriendConnection_cursor { edges: [DummyFriendEdge] pageInfo: DummyFriendPageInfo! totalCount: Int! From f2bf6ee56dd50901c943c463487ec72a9bb4a2e0 Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Sat, 18 Sep 2021 21:34:39 +0200 Subject: [PATCH 4/6] Changelog entry --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62f84437384..ce4d54a65af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 2.7.0 +* GraphQL: Add ability to use different pagination type from queries of a same resource (#4453) * Security: **BC** Fix `ApiProperty` `security` attribute expression being passed a class string for the `object` variable on updates/creates - null is now passed instead if the object is not available (#4184) * Security: `ApiProperty` now supports a `security_post_denormalize` attribute, which provides access to the `object` variable for the object being updated/created and `previous_object` for the object before it was updated (#4184) * Maker: Add `make:data-provider` and `make :data-persister` commands to generate a data provider / persister (#3850) @@ -231,7 +232,7 @@ For compatibility reasons with Symfony 5.2 and PHP 8, we do not test anymore the * Doctrine: Order filter doesn't throw anymore with numeric key (#3673 and #3687) * Doctrine: Fix ODM check change tracking deferred (#3629) * Doctrine: Allow 2inflector version 2.0 (#3607) -* OpenAPI: Allow subresources context to be added (#3685) +* OpenAPI: Allow subresources context to be added (#3685) * OpenAPI: Fix pagination documentation on subresources (#3678) * Subresource: Fix query when using a custom identifier (#3529 and #3671) * GraphQL: Fix relation types without Doctrine (#3591) @@ -337,7 +338,7 @@ For compatibility reasons with Symfony 5.2 and PHP 8, we do not test anymore the ## 2.5.0 beta 1 * Add an HTTP client dedicated to functional API testing (#2608) -* Add PATCH support (#2895) +* Add PATCH support (#2895) Note: with JSON Merge Patch, responses will skip null values. As this may break on some endpoints, you need to manually [add the `merge-patch+json` format](https://api-platform.com/docs/core/content-negotiation/#configuring-patch-formats) to enable PATCH support. This will be the default behavior in API Platform 3. * Add a command to generate json schemas `api:json-schema:generate` (#2996) * Add infrastructure to generate a JSON Schema from a Resource `ApiPlatform\Core\JsonSchema\SchemaFactoryInterface` (#2983) From d569065c2669d84b081842ee744dc4d4a8782ce5 Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Mon, 20 Sep 2021 12:55:27 +0200 Subject: [PATCH 5/6] Review --- CHANGELOG.md | 2 +- features/graphql/collection.feature | 2 +- features/graphql/introspection.feature | 10 +++++----- features/graphql/mutation.feature | 2 +- features/graphql/schema.feature | 4 ++-- src/GraphQl/Type/TypeBuilder.php | 11 ++++++----- tests/GraphQl/Type/TypeBuilderTest.php | 12 ++++++------ 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce4d54a65af..0c578b68cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.7.0 -* GraphQL: Add ability to use different pagination type from queries of a same resource (#4453) +* GraphQL: Add ability to use different pagination types for the queries of a resource (#4453) * Security: **BC** Fix `ApiProperty` `security` attribute expression being passed a class string for the `object` variable on updates/creates - null is now passed instead if the object is not available (#4184) * Security: `ApiProperty` now supports a `security_post_denormalize` attribute, which provides access to the `object` variable for the object being updated/created and `previous_object` for the object before it was updated (#4184) * Maker: Add `make:data-provider` and `make :data-persister` commands to generate a data provider / persister (#3850) diff --git a/features/graphql/collection.feature b/features/graphql/collection.feature index 39cc21e9a8f..5148acddfdf 100644 --- a/features/graphql/collection.feature +++ b/features/graphql/collection.feature @@ -9,7 +9,7 @@ Feature: GraphQL collection support ...dummyFields } } - fragment dummyFields on DummyConnection_cursor { + fragment dummyFields on DummyCursorConnection { edges { node { id diff --git a/features/graphql/introspection.feature b/features/graphql/introspection.feature index b23cdb6522b..e60211419c6 100644 --- a/features/graphql/introspection.feature +++ b/features/graphql/introspection.feature @@ -37,7 +37,7 @@ Feature: GraphQL introspection support } } } - type2: __type(name: "DummyAggregateOfferConnection_cursor") { + type2: __type(name: "DummyAggregateOfferCursorConnection") { description, fields { name @@ -76,7 +76,7 @@ Feature: GraphQL introspection support { "name":"offers", "type":{ - "name":"DummyAggregateOfferConnection_cursor", + "name":"DummyAggregateOfferCursorConnection", "kind":"OBJECT", "ofType":null } @@ -546,7 +546,7 @@ Feature: GraphQL introspection support When I send the following GraphQL request: """ { - typeNotAvailable: __type(name: "VoDummyInspectionConnection_cursor") { + typeNotAvailable: __type(name: "VoDummyInspectionCursorConnection") { description } typeOwner: __type(name: "VoDummyCar") { @@ -563,6 +563,6 @@ Feature: GraphQL introspection support Then the response status code should be 200 And the response should be in JSON And the header "Content-Type" should be equal to "application/json" - And the JSON node "errors[0].debugMessage" should be equal to 'Type with id "VoDummyInspectionConnection_cursor" is not present in the types container' + And the JSON node "errors[0].debugMessage" should be equal to 'Type with id "VoDummyInspectionCursorConnection" is not present in the types container' And the JSON node "data.typeNotAvailable" should be null - And the JSON node "data.typeOwner.fields[3].type.name" should be equal to "VoDummyInspectionConnection_cursor" + And the JSON node "data.typeOwner.fields[3].type.name" should be equal to "VoDummyInspectionCursorConnection" diff --git a/features/graphql/mutation.feature b/features/graphql/mutation.feature index 63463a070e9..e67e55554b4 100644 --- a/features/graphql/mutation.feature +++ b/features/graphql/mutation.feature @@ -709,7 +709,7 @@ Feature: GraphQL mutation support And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.__typename" should be equal to "updateThirdLevelNestedPayload" And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.fourthLevel.id" should be equal to "/fourth_levels/1" And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.fourthLevel.__typename" should be equal to "updateFourthLevelNestedPayload" - And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.__typename" should be equal to "updateRelatedToDummyFriendNestedPayloadConnection_cursor" + And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.__typename" should be equal to "updateRelatedToDummyFriendNestedPayloadCursorConnection" And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.edges[0].node.name" should be equal to "Relation-1" And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.edges[1].node.name" should be equal to "Relation-2" diff --git a/features/graphql/schema.feature b/features/graphql/schema.feature index a09a3b4487e..16c04d62d9d 100644 --- a/features/graphql/schema.feature +++ b/features/graphql/schema.feature @@ -17,7 +17,7 @@ Feature: GraphQL schema-related features } ###Connection for DummyFriend. (cursor)### - type DummyFriendConnection_cursor { + type DummyFriendCursorConnection { edges: [DummyFriendEdge] pageInfo: DummyFriendPageInfo! totalCount: Int! @@ -55,7 +55,7 @@ Feature: GraphQL schema-related features } # Connection for DummyFriend. (cursor) - type DummyFriendConnection_cursor { + type DummyFriendCursorConnection { edges: [DummyFriendEdge] pageInfo: DummyFriendPageInfo! totalCount: Int! diff --git a/src/GraphQl/Type/TypeBuilder.php b/src/GraphQl/Type/TypeBuilder.php index ad4b073ffc4..2021f68cbfe 100644 --- a/src/GraphQl/Type/TypeBuilder.php +++ b/src/GraphQl/Type/TypeBuilder.php @@ -226,8 +226,9 @@ public function getResourcePaginatedCollectionType(GraphQLType $resourceType, st $shortName = $resourceType->name; $paginationType = $this->pagination->getGraphQlPaginationType($resourceClass, $operationName); - if ($this->typesContainer->has("{$shortName}Connection_{$paginationType}")) { - return $this->typesContainer->get("{$shortName}Connection_{$paginationType}"); + $connectionTypeKey = sprintf('%s%sConnection', $shortName, ucfirst($paginationType)); + if ($this->typesContainer->has($connectionTypeKey)) { + return $this->typesContainer->get($connectionTypeKey); } $fields = 'cursor' === $paginationType ? @@ -235,13 +236,13 @@ public function getResourcePaginatedCollectionType(GraphQLType $resourceType, st $this->getPageBasedPaginationFields($resourceType); $configuration = [ - 'name' => "{$shortName}Connection_{$paginationType}", - 'description' => "Connection for $shortName. ({$paginationType})", + 'name' => $connectionTypeKey, + 'description' => sprintf("%s connection for $shortName.", ucfirst($paginationType)), 'fields' => $fields, ]; $resourcePaginatedCollectionType = new ObjectType($configuration); - $this->typesContainer->set("{$shortName}Connection_{$paginationType}", $resourcePaginatedCollectionType); + $this->typesContainer->set($connectionTypeKey, $resourcePaginatedCollectionType); return $resourcePaginatedCollectionType; } diff --git a/tests/GraphQl/Type/TypeBuilderTest.php b/tests/GraphQl/Type/TypeBuilderTest.php index 9b20dbee1f0..4d8d797d175 100644 --- a/tests/GraphQl/Type/TypeBuilderTest.php +++ b/tests/GraphQl/Type/TypeBuilderTest.php @@ -472,8 +472,8 @@ public function testGetNodeInterface(): void public function testCursorBasedGetResourcePaginatedCollectionType(): void { - $this->typesContainerProphecy->has('StringConnection_cursor')->shouldBeCalled()->willReturn(false); - $this->typesContainerProphecy->set('StringConnection_cursor', Argument::type(ObjectType::class))->shouldBeCalled(); + $this->typesContainerProphecy->has('StringCursorConnection')->shouldBeCalled()->willReturn(false); + $this->typesContainerProphecy->set('StringCursorConnection', Argument::type(ObjectType::class))->shouldBeCalled(); $this->typesContainerProphecy->set('StringEdge', Argument::type(ObjectType::class))->shouldBeCalled(); $this->typesContainerProphecy->set('StringPageInfo', Argument::type(ObjectType::class))->shouldBeCalled(); $this->resourceMetadataCollectionFactoryProphecy->create('StringResourceClass')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('StringResourceClass', [ @@ -484,7 +484,7 @@ public function testCursorBasedGetResourcePaginatedCollectionType(): void /** @var ObjectType $resourcePaginatedCollectionType */ $resourcePaginatedCollectionType = $this->typeBuilder->getResourcePaginatedCollectionType(GraphQLType::string(), 'StringResourceClass', 'operationName'); - $this->assertSame('StringConnection_cursor', $resourcePaginatedCollectionType->name); + $this->assertSame('StringCursorConnection', $resourcePaginatedCollectionType->name); $this->assertSame('Connection for String. (cursor)', $resourcePaginatedCollectionType->description); $resourcePaginatedCollectionTypeFields = $resourcePaginatedCollectionType->getFields(); @@ -531,8 +531,8 @@ public function testCursorBasedGetResourcePaginatedCollectionType(): void public function testPageBasedGetResourcePaginatedCollectionType(): void { - $this->typesContainerProphecy->has('StringConnection_page')->shouldBeCalled()->willReturn(false); - $this->typesContainerProphecy->set('StringConnection_page', Argument::type(ObjectType::class))->shouldBeCalled(); + $this->typesContainerProphecy->has('StringPageConnection')->shouldBeCalled()->willReturn(false); + $this->typesContainerProphecy->set('StringPageConnection', Argument::type(ObjectType::class))->shouldBeCalled(); $this->typesContainerProphecy->set('StringPaginationInfo', Argument::type(ObjectType::class))->shouldBeCalled(); $this->resourceMetadataCollectionFactoryProphecy->create('StringResourceClass')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('StringResourceClass', [ @@ -543,7 +543,7 @@ public function testPageBasedGetResourcePaginatedCollectionType(): void /** @var ObjectType $resourcePaginatedCollectionType */ $resourcePaginatedCollectionType = $this->typeBuilder->getResourcePaginatedCollectionType(GraphQLType::string(), 'StringResourceClass', 'operationName'); - $this->assertSame('StringConnection_page', $resourcePaginatedCollectionType->name); + $this->assertSame('StringPageConnection', $resourcePaginatedCollectionType->name); $this->assertSame('Connection for String. (page)', $resourcePaginatedCollectionType->description); $resourcePaginatedCollectionTypeFields = $resourcePaginatedCollectionType->getFields(); From a3d825cdc10ca3adca12f1c8fc43948043fb7e73 Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Mon, 20 Sep 2021 14:06:00 +0200 Subject: [PATCH 6/6] Fixes --- features/graphql/schema.feature | 4 ++-- tests/GraphQl/Type/TypeBuilderTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/graphql/schema.feature b/features/graphql/schema.feature index 16c04d62d9d..765905fce98 100644 --- a/features/graphql/schema.feature +++ b/features/graphql/schema.feature @@ -16,7 +16,7 @@ Feature: GraphQL schema-related features name: String! } - ###Connection for DummyFriend. (cursor)### + ###Cursor connection for DummyFriend.### type DummyFriendCursorConnection { edges: [DummyFriendEdge] pageInfo: DummyFriendPageInfo! @@ -54,7 +54,7 @@ Feature: GraphQL schema-related features name: String! } - # Connection for DummyFriend. (cursor) + # Cursor connection for DummyFriend. type DummyFriendCursorConnection { edges: [DummyFriendEdge] pageInfo: DummyFriendPageInfo! diff --git a/tests/GraphQl/Type/TypeBuilderTest.php b/tests/GraphQl/Type/TypeBuilderTest.php index 4d8d797d175..11c6f8aeb1a 100644 --- a/tests/GraphQl/Type/TypeBuilderTest.php +++ b/tests/GraphQl/Type/TypeBuilderTest.php @@ -485,7 +485,7 @@ public function testCursorBasedGetResourcePaginatedCollectionType(): void /** @var ObjectType $resourcePaginatedCollectionType */ $resourcePaginatedCollectionType = $this->typeBuilder->getResourcePaginatedCollectionType(GraphQLType::string(), 'StringResourceClass', 'operationName'); $this->assertSame('StringCursorConnection', $resourcePaginatedCollectionType->name); - $this->assertSame('Connection for String. (cursor)', $resourcePaginatedCollectionType->description); + $this->assertSame('Cursor connection for String.', $resourcePaginatedCollectionType->description); $resourcePaginatedCollectionTypeFields = $resourcePaginatedCollectionType->getFields(); $this->assertArrayHasKey('edges', $resourcePaginatedCollectionTypeFields); @@ -544,7 +544,7 @@ public function testPageBasedGetResourcePaginatedCollectionType(): void /** @var ObjectType $resourcePaginatedCollectionType */ $resourcePaginatedCollectionType = $this->typeBuilder->getResourcePaginatedCollectionType(GraphQLType::string(), 'StringResourceClass', 'operationName'); $this->assertSame('StringPageConnection', $resourcePaginatedCollectionType->name); - $this->assertSame('Connection for String. (page)', $resourcePaginatedCollectionType->description); + $this->assertSame('Page connection for String.', $resourcePaginatedCollectionType->description); $resourcePaginatedCollectionTypeFields = $resourcePaginatedCollectionType->getFields(); $this->assertArrayHasKey('collection', $resourcePaginatedCollectionTypeFields);