Description
Error
Given:
interface Node {
id: ID!
}
type A implements Node {
id: ID!
a: String!
}
type B implements Node {
id: ID!
b: String!
}
type C implements Node {
id: ID!
c: String!
}
union ABC = A | B | C
query {
search(input: InputType!): ABC
}
If I make the following query to this mock api:
{
search(input: { ... }) {
... on A {
a
}
... on B {
b
}
... on C {
c
}
... on Node {
id
}
}
}
I get a panic error that Node does not implement ABC, originating from the following line of code:
graphql-go/internal/exec/selected/selected.go
Line 170 in bb97385
Expected
I expect the Node inline fragment to resolve just fine, because A) relay makes queries of this nature via its api, and B) each type in the union implements the Node interface.
Probable source of the error
Looking through the code I can see - correct me if I'm wrong - that the type assertion is only checking for possible types for the union. It is not checking if A) the inline fragment is an interface type, or if B) the union objects implement said interface.
Update
I've decided to just make all my union types into interface types for the time being.