type Query {
nodes: [Node]
}
interface Node {
id: ID!
}
type Oven @key(fields: "id") {
id: ID!
}
type Toaster implements Node @key(fields: "id") {
id: ID!
warranty: Int
}
B
interface Node {
id: ID!
}
type Oven implements Node @key(fields: "id") {
id: ID!
warranty: Int
}
And the following query:
query {
nodes {
... on Oven { id }
... on Toaster { id }
}
}
The Oven and Toaster object types both implement the Node interface in the public API schema.
It looks like Oven could be queries through Query.nodes, but in reality, it's not true. The Oven is never resolved by Query.nodes as Oven object type is not implementing Node interface in the subgraph that defines Query.nodes (A).
The gateway should remove ... on Oven fragment from the query and pass the following query to the subgraph A:
Given these subgraphs:
A
B
And the following query:
The
Oven
andToaster
object types both implement theNode
interface in the public API schema. It looks likeOven
could be queries throughQuery.nodes
, but in reality, it's not true. TheOven
is never resolved byQuery.nodes
asOven
object type is not implementingNode
interface in the subgraph that definesQuery.nodes
(A).The gateway should remove
... on Oven
fragment from the query and pass the following query to the subgraph A: