When using the "extend" keyword only, types aren't automatically imported
antogyn opened this issue · 0 comments
antogyn commented
Hey,
When using extend
with a type, if it isn't anywhere in the schema without extend
, input and return types used in its fields and the type itself aren't in the final schema unless explicitly imported.
This is a problem in federated services which sometimes only extend certain types.
# query.graphql
extend type Query {
test: Test
}
type Test {
ok: Boolean
}
# schema.graphql
# import Query from "query.graphql"
schema after importing schema.graphql
(Test
is absent):
extend type Query {
test: Test!
}
Adding type Query { anyField: AnyType }
anywhere produces a valid schema, but also drops the extend
keyword
Other import methods:
# import Query.* from "query.graphql"
Same result
# import "query.graphql"
# import * from "query.graphql"
The Query
type is not present at all (so in the exemple, it throws because it's an empty schema)