From dadd78a2963edc418305e70b6127f72e35bf08c2 Mon Sep 17 00:00:00 2001 From: murtukov Date: Mon, 25 Jan 2021 16:21:13 +0100 Subject: [PATCH 1/2] Allow interfaces implement interfaces --- src/Config/InterfaceTypeDefinition.php | 4 ++ tests/Functional/App/config/global/config.yml | 1 + .../Command/fixtures/schema.descriptions.json | 2 +- tests/Functional/Relay/Node/GlobalTest.php | 56 +++++++++---------- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/Config/InterfaceTypeDefinition.php b/src/Config/InterfaceTypeDefinition.php index dcca745a7..e24e59c49 100644 --- a/src/Config/InterfaceTypeDefinition.php +++ b/src/Config/InterfaceTypeDefinition.php @@ -13,12 +13,16 @@ public function getDefinition(): ArrayNodeDefinition /** @var ArrayNodeDefinition $node */ $node = self::createNode('_interface_config'); + /** @phpstan-ignore-next-line */ $node ->children() ->append($this->nameSection()) ->append($this->outputFieldsSection()) ->append($this->resolveTypeSection()) ->append($this->descriptionSection()) + ->arrayNode('interfaces') + ->prototype('scalar')->info('One of internal or custom interface types.')->end() + ->end() ->end(); return $node; diff --git a/tests/Functional/App/config/global/config.yml b/tests/Functional/App/config/global/config.yml index 39a5b5191..120f1b25e 100644 --- a/tests/Functional/App/config/global/config.yml +++ b/tests/Functional/App/config/global/config.yml @@ -15,6 +15,7 @@ overblog_graphql: schema: query: Query mutation: ~ + types: [User, Photo, Post] mappings: types: - diff --git a/tests/Functional/Command/fixtures/schema.descriptions.json b/tests/Functional/Command/fixtures/schema.descriptions.json index 51708f3bf..7d060c5fe 100644 --- a/tests/Functional/Command/fixtures/schema.descriptions.json +++ b/tests/Functional/Command/fixtures/schema.descriptions.json @@ -782,7 +782,7 @@ }, { "name": "INTERFACE", - "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", + "description": "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.", "isDeprecated": false, "deprecationReason": null }, diff --git a/tests/Functional/Relay/Node/GlobalTest.php b/tests/Functional/Relay/Node/GlobalTest.php index a29dcd04b..94eb07bdd 100644 --- a/tests/Functional/Relay/Node/GlobalTest.php +++ b/tests/Functional/Relay/Node/GlobalTest.php @@ -16,19 +16,18 @@ class GlobalTest extends TestCase protected function setUp(): void { parent::setUp(); - static::bootKernel(['test_case' => 'global']); } public function testGlobalIdFields(): void { $query = <<<'EOF' -{ - allObjects { - id - } -} -EOF; + { + allObjects { + id + } + } + EOF; $expectedData = [ 'allObjects' => [ @@ -59,28 +58,29 @@ public function testGlobalIdFields(): void public function testReFetchesTheIds(): void { $query = <<<'EOF' -{ - user: node(id: "VXNlcjox") { - id - ... on User { - name + { + user: node(id: "VXNlcjox") { + id + ... on User { + name + } + }, + photo: node(id: "UGhvdG86MQ==") { + id + ... on Photo { + width + } + }, + post: node(id: "UG9zdDox") { + id + ... on Post { + text + status + } + } } - }, - photo: node(id: "UGhvdG86MQ==") { - id - ... on Photo { - width - } - }, - post: node(id: "UG9zdDox") { - id - ... on Post { - text - status - } - } - } -EOF; + EOF; + $expectedData = [ 'user' => [ 'id' => 'VXNlcjox', From db8ff32970c2366fdc492e7f0240fb0b2e02ce82 Mon Sep 17 00:00:00 2001 From: murtukov Date: Mon, 25 Jan 2021 17:02:57 +0100 Subject: [PATCH 2/2] Change version constraint for webonyx/graphql-php --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1446d4f7d..14fa5734f 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "symfony/framework-bundle": "^4.4 || ^5.0", "symfony/options-resolver": "^4.4 || ^5.0", "symfony/property-access": "^4.4 || ^5.0", - "webonyx/graphql-php": "^14.0.1" + "webonyx/graphql-php": ">=14.5" }, "suggest": { "nelmio/cors-bundle": "For more flexibility when using CORS prefight",