-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
1,025 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
267 changes: 267 additions & 0 deletions
267
...on/polymorphic hydrations/batch-polymorphic-hydration-return-null-in-array-with-error.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,267 @@ | ||
name: "batch polymorphic hydration return null in array with error" | ||
enabled: true | ||
# language=GraphQL | ||
overallSchema: | ||
pets: | | ||
type Query { | ||
petById(ids: [ID]): [Pet] | ||
} | ||
type Pet { | ||
id: ID | ||
breed: String | ||
} | ||
people: | | ||
type Query { | ||
humanById(ids: [ID]): [Human] | ||
} | ||
type Human { | ||
id: ID | ||
name: String | ||
} | ||
foo: | | ||
type Query { | ||
foo: [Foo] | ||
} | ||
type Foo { | ||
id: ID | ||
dataId: ID | ||
data: Data | ||
@hydrated( | ||
service: "pets" | ||
field: "petById" | ||
arguments: [ | ||
{name: "ids" value: "$source.dataId"} | ||
] | ||
) | ||
@hydrated( | ||
service: "people" | ||
field: "humanById" | ||
arguments: [ | ||
{name: "ids" value: "$source.dataId"} | ||
] | ||
) | ||
} | ||
union Data = Pet | Human | ||
# language=GraphQL | ||
underlyingSchema: | ||
pets: | | ||
type Query { | ||
petById(ids: [ID]): [Pet] | ||
} | ||
type Pet { | ||
id: ID | ||
breed: String | ||
} | ||
people: | | ||
type Query { | ||
humanById(ids: [ID]): [Human] | ||
} | ||
type Human { | ||
id: ID | ||
name: String | ||
} | ||
foo: | | ||
type Query { | ||
foo: [Foo] | ||
} | ||
type Foo { | ||
id: ID | ||
dataId: ID | ||
} | ||
# language=GraphQL | ||
query: | | ||
query { | ||
foo { | ||
__typename | ||
id | ||
data { | ||
... on Pet { | ||
__typename | ||
id | ||
breed | ||
} | ||
... on Human { | ||
__typename | ||
id | ||
name | ||
} | ||
} | ||
} | ||
} | ||
variables: { } | ||
serviceCalls: | ||
- serviceName: "foo" | ||
request: | ||
# language=GraphQL | ||
query: | | ||
query { | ||
foo { | ||
__typename | ||
__typename__batch_hydration__data: __typename | ||
batch_hydration__data__dataId: dataId | ||
batch_hydration__data__dataId: dataId | ||
id | ||
} | ||
} | ||
variables: { } | ||
# language=JSON | ||
response: |- | ||
{ | ||
"data": { | ||
"foo": [ | ||
{ | ||
"__typename": "Foo", | ||
"__typename__batch_hydration__data": "Foo", | ||
"batch_hydration__data__dataId": "PET-0", | ||
"batch_hydration__data__dataId": "PET-0", | ||
"id": "FOO-0" | ||
}, | ||
{ | ||
"__typename": "Foo", | ||
"__typename__batch_hydration__data": "Foo", | ||
"batch_hydration__data__dataId": "HUMAN-0", | ||
"batch_hydration__data__dataId": "HUMAN-0", | ||
"id": "FOO-1" | ||
}, | ||
{ | ||
"__typename": "Foo", | ||
"__typename__batch_hydration__data": "Foo", | ||
"batch_hydration__data__dataId": "PET-1", | ||
"batch_hydration__data__dataId": "PET-1", | ||
"id": "FOO-2" | ||
}, | ||
{ | ||
"__typename": "Foo", | ||
"__typename__batch_hydration__data": "Foo", | ||
"batch_hydration__data__dataId": "HUMAN-1", | ||
"batch_hydration__data__dataId": "HUMAN-1", | ||
"id": "FOO-3" | ||
} | ||
] | ||
}, | ||
"extensions": {} | ||
} | ||
- serviceName: "pets" | ||
request: | ||
# language=GraphQL | ||
query: | | ||
query { | ||
petById(ids: ["PET-0", "PET-1"]) { | ||
__typename | ||
breed | ||
id | ||
batch_hydration__data__id: id | ||
} | ||
} | ||
variables: { } | ||
# language=JSON | ||
response: |- | ||
{ | ||
"data": { | ||
"petById": [ | ||
null, | ||
{ | ||
"__typename": "Pet", | ||
"breed": "Labrador", | ||
"id": "PET-1", | ||
"batch_hydration__data__id": "PET-1" | ||
} | ||
] | ||
}, | ||
"errors": [ | ||
{ | ||
"message": "invalid id PET-0" | ||
} | ||
], | ||
"extensions": {} | ||
} | ||
- serviceName: "people" | ||
request: | ||
# language=GraphQL | ||
query: | | ||
query { | ||
humanById(ids: ["HUMAN-0", "HUMAN-1"]) { | ||
__typename | ||
id | ||
batch_hydration__data__id: id | ||
name | ||
} | ||
} | ||
variables: { } | ||
# language=JSON | ||
response: |- | ||
{ | ||
"data": { | ||
"humanById": [ | ||
{ | ||
"__typename": "Human", | ||
"id": "HUMAN-0", | ||
"batch_hydration__data__id": "HUMAN-0", | ||
"name": "Fanny Longbottom" | ||
}, | ||
{ | ||
"__typename": "Human", | ||
"id": "HUMAN-1", | ||
"batch_hydration__data__id": "HUMAN-1", | ||
"name": "John Doe" | ||
} | ||
] | ||
}, | ||
"extensions": {} | ||
} | ||
# language=JSON | ||
response: |- | ||
{ | ||
"data": { | ||
"foo": [ | ||
{ | ||
"__typename": "Foo", | ||
"id": "FOO-0", | ||
"data": null | ||
}, | ||
{ | ||
"__typename": "Foo", | ||
"id": "FOO-1", | ||
"data": { | ||
"__typename": "Human", | ||
"id": "HUMAN-0", | ||
"name": "Fanny Longbottom" | ||
} | ||
}, | ||
{ | ||
"__typename": "Foo", | ||
"id": "FOO-2", | ||
"data": { | ||
"__typename": "Pet", | ||
"breed": "Labrador", | ||
"id": "PET-1" | ||
} | ||
}, | ||
{ | ||
"__typename": "Foo", | ||
"id": "FOO-3", | ||
"data": { | ||
"__typename": "Human", | ||
"id": "HUMAN-1", | ||
"name": "John Doe" | ||
} | ||
} | ||
] | ||
}, | ||
"errors": [ | ||
{ | ||
"message": "invalid id PET-0", | ||
"locations": [], | ||
"extensions": { | ||
"classification": "DataFetchingException" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.