Skip to content

Commit 2b64eaa

Browse files
committed
Comment problematic code parts
1 parent c605d81 commit 2b64eaa

File tree

2 files changed

+46
-39
lines changed

2 files changed

+46
-39
lines changed

features/graphql/mutation.feature

+40-36
Original file line numberDiff line numberDiff line change
@@ -106,43 +106,47 @@ Feature: GraphQL mutation support
106106
And the JSON node "data.createDummy.arrayData[1]" should be equal to baz
107107
And the JSON node "data.createDummy.clientMutationId" should be equal to "myId"
108108

109-
Scenario: Create an item with an embedded field
110-
When I send the following GraphQL request:
111-
"""
112-
mutation {
113-
createRelatedDummy(input: {_id: 2, symfony: "symfony", embeddedDummy: {dummyName: "Embedded"}, clientMutationId: "myId"}) {
114-
id
115-
clientMutationId
116-
}
117-
}
118-
"""
119-
Then the response status code should be 200
120-
And the response should be in JSON
121-
And the header "Content-Type" should be equal to "application/json"
122-
And the JSON node "data.createRelatedDummy.id" should be equal to "/related_dummies/2"
123-
And the JSON node "data.createRelatedDummy.clientMutationId" should be equal to "myId"
109+
# @TODO StringIterableUnionInput is not used for now because it breaks graphql-php and GraphiQL.
110+
# Waiting for https://github.com/facebook/graphql/pull/395 to be merged.
111+
# Scenario: Create an item with an embedded field
112+
# When I send the following GraphQL request:
113+
# """
114+
# mutation {
115+
# createRelatedDummy(input: {_id: 2, symfony: "symfony", embeddedDummy: {dummyName: "Embedded"}, clientMutationId: "myId"}) {
116+
# id
117+
# clientMutationId
118+
# }
119+
# }
120+
# """
121+
# Then the response status code should be 200
122+
# And the response should be in JSON
123+
# And the header "Content-Type" should be equal to "application/json"
124+
# And the JSON node "data.createRelatedDummy.id" should be equal to "/related_dummies/2"
125+
# And the JSON node "data.createRelatedDummy.clientMutationId" should be equal to "myId"
124126

125-
Scenario: Create an item and update a nested resource through a mutation
126-
When I send the following GraphQL request:
127-
"""
128-
mutation {
129-
createRelationEmbedder(input: {paris: "paris", krondstadt: "Krondstadt", anotherRelated: {id: 2, symfony: "laravel"}, clientMutationId: "myId"}) {
130-
id
131-
anotherRelated {
132-
id
133-
symfony
134-
}
135-
clientMutationId
136-
}
137-
}
138-
"""
139-
Then the response status code should be 200
140-
And the response should be in JSON
141-
And the header "Content-Type" should be equal to "application/json"
142-
And the JSON node "data.createRelationEmbedder.id" should be equal to "/relation_embedders/1"
143-
And the JSON node "data.createRelationEmbedder.anotherRelated.id" should be equal to "/related_dummies/2"
144-
And the JSON node "data.createRelationEmbedder.anotherRelated.symfony" should be equal to "laravel"
145-
And the JSON node "data.createRelationEmbedder.clientMutationId" should be equal to "myId"
127+
# @TODO StringIterableUnionInput is not used for now because it breaks graphql-php and GraphiQL.
128+
# Waiting for https://github.com/facebook/graphql/pull/395 to be merged.
129+
# Scenario: Create an item and update a nested resource through a mutation
130+
# When I send the following GraphQL request:
131+
# """
132+
# mutation {
133+
# createRelationEmbedder(input: {paris: "paris", krondstadt: "Krondstadt", anotherRelated: {id: 2, symfony: "laravel"}, clientMutationId: "myId"}) {
134+
# id
135+
# anotherRelated {
136+
# id
137+
# symfony
138+
# }
139+
# clientMutationId
140+
# }
141+
# }
142+
# """
143+
# Then the response status code should be 200
144+
# And the response should be in JSON
145+
# And the header "Content-Type" should be equal to "application/json"
146+
# And the JSON node "data.createRelationEmbedder.id" should be equal to "/relation_embedders/1"
147+
# And the JSON node "data.createRelationEmbedder.anotherRelated.id" should be equal to "/related_dummies/2"
148+
# And the JSON node "data.createRelationEmbedder.anotherRelated.symfony" should be equal to "laravel"
149+
# And the JSON node "data.createRelationEmbedder.clientMutationId" should be equal to "myId"
146150

147151
Scenario: Delete an item through a mutation
148152
When I send the following GraphQL request:

src/GraphQl/Type/SchemaBuilder.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use ApiPlatform\Core\Exception\ResourceClassNotFoundException;
1717
use ApiPlatform\Core\GraphQl\Resolver\Factory\ResolverFactoryInterface;
1818
use ApiPlatform\Core\GraphQl\Serializer\ItemNormalizer;
19-
use ApiPlatform\Core\GraphQl\Type\Definition\InputUnionType;
2019
use ApiPlatform\Core\GraphQl\Type\Definition\IterableType;
2120
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2221
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
@@ -347,7 +346,10 @@ private function convertType(Type $type, bool $input = false, string $mutationNa
347346
break;
348347
case Type::BUILTIN_TYPE_OBJECT:
349348
if ($input && $depth > 0) {
350-
if (!isset($this->graphqlTypes['#stringIterableUnionInput'])) {
349+
/* @TODO Don't use StringIterableUnionInput for now because it breaks graphql-php and GraphiQL.
350+
* Waiting for https://github.com/facebook/graphql/pull/395 to be merged.
351+
*/
352+
/*if (!isset($this->graphqlTypes['#stringIterableUnionInput'])) {
351353
$this->graphqlTypes['#stringIterableUnionInput'] = new InputUnionType([
352354
'name' => 'StringIterableUnionInput',
353355
'description' => 'Resource\'s IRI or data (embedded entities or when updating a related existing resource)',
@@ -357,7 +359,8 @@ private function convertType(Type $type, bool $input = false, string $mutationNa
357359
],
358360
]);
359361
}
360-
$graphqlType = $this->graphqlTypes['#stringIterableUnionInput'];
362+
$graphqlType = $this->graphqlTypes['#stringIterableUnionInput'];*/
363+
$graphqlType = GraphQLType::string();
361364
break;
362365
}
363366
if (is_a($type->getClassName(), \DateTimeInterface::class, true)) {

0 commit comments

Comments
 (0)