Description
getIntrospectionQuery
only requests the name
field from the root queryType
object
(https://github.com/graphql/graphql-js/blob/6e48d16f92b9a6df8638b1486354c6be2537033b/src/utilities/getIntrospectionQuery.ts)
queryType { name }
yet the IntrospectionQuery
datatype defines queryType
as IntrospectionNamedTypeRef
(https://github.com/graphql/graphql-js/blob/main/src/utilities/getIntrospectionQuery.ts#L167) which requires kind
as well
export interface IntrospectionNamedTypeRef<
T extends IntrospectionType = IntrospectionType,
> {
readonly kind: T['kind'];
readonly name: string;
}
This means that copying the result of the querying a GQL API with the introspection query as JSON and trying to assign to IntrospectionQuery
will fail with:
The types of '__schema.queryType' are incompatible between these types.
Property 'kind' is missing in type '{ name: string; }' but required in type 'IntrospectionNamedTypeRef'.
Activity
sibo2000 commentedon Dec 16, 2021
Bumping this.
conatus commentedon Apr 26, 2022
Still seeing this issue. At the moment, chucking in a
@ts-ignore
but would be nice to have a firmer fix.Exact same situation, passing an introspection in JSON into
buildClientSchema
. Using the very latestgraphql
at16.4.0
.Produces the following error:
Other issues downstream in users of this library:
conatus commentedon Apr 26, 2022
Wondered if making kind option would be enough, and it creates further problems upstream.
yaacovCR commentedon May 22, 2022
@IvanGoncharov is it simply a matter of fixing
getIntrospectionQuery
to includekind
as hinted at above?yaacovCR commentedon May 25, 2022
Or is that silly because the kind is obvious for root types? And we need a new introspection type for root types?
Include kind in the types (#4222)
Backport introspection type fix (graphql#4226)
Include kind in the types (#4222)