From 99ada9547497c6eb8e9a3afac72a862a2dff3392 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 11 Oct 2024 15:36:14 +0200 Subject: [PATCH] Include kind in the types (#4222) Supersedes https://github.com/graphql/graphql-js/pull/3910 Fixes https://github.com/graphql/graphql-js/issues/3909 Fixes https://github.com/graphql/graphql-js/issues/3409 This puts the Selection-set in line with the expected type --- src/type/__tests__/introspection-test.ts | 2 +- src/utilities/__tests__/buildClientSchema-test.ts | 2 +- src/utilities/getIntrospectionQuery.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts index c9145707..803e3468 100644 --- a/src/type/__tests__/introspection-test.ts +++ b/src/type/__tests__/introspection-test.ts @@ -32,7 +32,7 @@ describe('Introspection', () => { expect(result).to.deep.equal({ data: { __schema: { - queryType: { name: 'SomeObject' }, + queryType: { name: 'SomeObject', kind: 'OBJECT' }, mutationType: null, subscriptionType: null, types: [ diff --git a/src/utilities/__tests__/buildClientSchema-test.ts b/src/utilities/__tests__/buildClientSchema-test.ts index 0ad292d0..4fd2dbcd 100644 --- a/src/utilities/__tests__/buildClientSchema-test.ts +++ b/src/utilities/__tests__/buildClientSchema-test.ts @@ -716,7 +716,7 @@ describe('Type System: build schema from introspection', () => { delete introspection.__schema.queryType.name; expect(() => buildClientSchema(introspection)).to.throw( - 'Unknown type reference: {}.', + 'Unknown type reference: { kind: "OBJECT" }.', ); }); diff --git a/src/utilities/getIntrospectionQuery.ts b/src/utilities/getIntrospectionQuery.ts index 9fc8963f..b516dda3 100644 --- a/src/utilities/getIntrospectionQuery.ts +++ b/src/utilities/getIntrospectionQuery.ts @@ -77,9 +77,9 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string { query IntrospectionQuery { __schema { ${schemaDescription} - queryType { name } - mutationType { name } - subscriptionType { name } + queryType { name kind } + mutationType { name kind } + subscriptionType { name kind } types { ...FullType }