graphql-jit
graphql-jit copied to clipboard
Field Expansion for Union and Interfaces misbehaving
Description
When Union or interfaces are sharing the same types too
as in the bellow schema, too
is expanded for all types(Foo and Bar), We expect shared fields are expand only for fields used in query
Given Schema
type Query {
uBaz: Baz
}
union Baz = Foo | Bar
type Foo {
foo: String
too: String
}
type Bar {
bar: Int
too: String
}
`
and Query
`
query {
uBaz {
... on Foo {
foo
too
}
... on Bar {
bar
}
}
}
`
Expected info.fieldExpansion
is
Object {
"Bar": Object {
"bar": Object {
Symbol(LeafFieldSymbol): true,
},
},
"Foo": Object {
"foo": Object {
Symbol(LeafFieldSymbol): true,
},
"too": Object {
Symbol(LeafFieldSymbol): true,
},
},
}
But Actual info.fieldExpansion
is
Object {
"Bar": Object {
"bar": Object {
Symbol(LeafFieldSymbol): true,
},
"too": Object { <--------- `too` is not expected as its not in the query
Symbol(LeafFieldSymbol): true,
},
},
"Foo": Object {
"foo": Object {
Symbol(LeafFieldSymbol): true,
},
"too": Object {
Symbol(LeafFieldSymbol): true,
},
},
}