Skip to content

Commit f8bc049

Browse files
committed
fix(graphql): wrapped type should always take the query normalization context
1 parent ca6353c commit f8bc049

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

features/graphql/input_output.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Feature: GraphQL DTO input and output
148148
{
149149
"errors": [
150150
{
151-
"message": "Cannot query field \"id\" on type \"createDummyDtoNoOutputPayloadData\".",
151+
"message": "Cannot query field \"id\" on type \"DummyDtoNoOutput\".",
152152
"extensions": {
153153
"category": "graphql"
154154
},

features/graphql/mutation.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ Feature: GraphQL mutation support
400400
And the header "Content-Type" should be equal to "application/json"
401401
And the JSON node "data.createFoo.foo.id" should be equal to "/foos/1"
402402
And the JSON node "data.createFoo.foo._id" should be equal to 1
403-
And the JSON node "data.createFoo.foo.__typename" should be equal to "createFooPayloadData"
403+
And the JSON node "data.createFoo.foo.__typename" should be equal to "Foo"
404404
And the JSON node "data.createFoo.foo.name" should be equal to "A new one"
405405
And the JSON node "data.createFoo.foo.bar" should be equal to "new"
406406
And the JSON node "data.createFoo.clientMutationId" should be equal to "myId"

src/GraphQl/Type/TypeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function getResourceObjectType(?string $resourceClass, ResourceMetadataCo
116116
'fields' => function () use ($resourceClass, $operation, $operationName, $resourceMetadataCollection, $input, $wrapData, $depth, $ioMetadata) {
117117
if ($wrapData) {
118118
try {
119-
$queryNormalizationContext = $operation instanceof Query ? ($resourceMetadataCollection->getOperation($operationName)->getNormalizationContext() ?? []) : [];
119+
$queryNormalizationContext = $resourceMetadataCollection->getOperation('item_query')->getNormalizationContext() ?? [];
120120
} catch (OperationNotFoundException $e) {
121121
$queryNormalizationContext = [];
122122
}

0 commit comments

Comments
 (0)