Skip to content

Commit

Permalink
Enable schemaDescription for getIntrospectionQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Dec 4, 2021
1 parent fe5bb0d commit 1cc793a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smooth-elephants-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphiql': patch
---

Include schema description in DocExplorer for schema introspection requests. Enables the `schemaDescription` option for `getIntrospectionQuery()`.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ describe('DocExplorer', () => {
const { container } = render(<DocExplorer schema={ExampleSchema} />);
const error = container.querySelectorAll('.error-container');
expect(error).toHaveLength(0);
expect(container.querySelector('.doc-type-description')).toHaveTextContent(
'GraphQL Schema for testing',
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ export const ExampleQuery = new GraphQLObjectType({

export const ExampleSchema = new GraphQLSchema({
query: ExampleQuery,
description: 'GraphQL Schema for testing',
});
4 changes: 3 additions & 1 deletion packages/graphiql/src/utility/introspectionQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import { getIntrospectionQuery } from 'graphql';

export const introspectionQuery = getIntrospectionQuery();
export const introspectionQuery = getIntrospectionQuery({
schemaDescription: true,
});

export const staticName = 'IntrospectionQuery';

Expand Down
1 change: 1 addition & 0 deletions packages/graphiql/test/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ const myTestSchema = new GraphQLSchema({
query: TestType,
mutation: TestMutationType,
subscription: TestSubscriptionType,
description: 'This is a test schema for GraphiQL',
});

module.exports = myTestSchema;

0 comments on commit 1cc793a

Please sign in to comment.