Skip to content

Commit

Permalink
introspectionFromSchema: enable 'specifiedByUrl' by default (graphql#…
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored and saihaj committed Jan 12, 2021
1 parent e7214b6 commit 4da6b13
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/utilities/__tests__/buildClientSchema-test.js
Expand Up @@ -31,15 +31,10 @@ import { introspectionFromSchema } from '../introspectionFromSchema';
* returns that schema printed as SDL.
*/
function cycleIntrospection(sdlString: string): string {
const options = {
specifiedByUrl: true,
directiveIsRepeatable: true,
};

const serverSchema = buildSchema(sdlString);
const initialIntrospection = introspectionFromSchema(serverSchema, options);
const initialIntrospection = introspectionFromSchema(serverSchema);
const clientSchema = buildClientSchema(initialIntrospection);
const secondIntrospection = introspectionFromSchema(clientSchema, options);
const secondIntrospection = introspectionFromSchema(clientSchema);

/**
* If the client then runs the introspection query against the client-side
Expand Down
2 changes: 2 additions & 0 deletions src/utilities/__tests__/introspectionFromSchema-test.js
Expand Up @@ -18,6 +18,7 @@ function introspectionToSDL(introspection: IntrospectionQuery): string {

describe('introspectionFromSchema', () => {
const schema = new GraphQLSchema({
description: 'This is a simple schema',
query: new GraphQLObjectType({
name: 'Simple',
description: 'This is a simple type',
Expand All @@ -34,6 +35,7 @@ describe('introspectionFromSchema', () => {
const introspection = introspectionFromSchema(schema);

expect(introspectionToSDL(introspection)).to.deep.equal(dedent`
"""This is a simple schema"""
schema {
query: Simple
}
Expand Down
1 change: 1 addition & 0 deletions src/utilities/introspectionFromSchema.js
Expand Up @@ -26,6 +26,7 @@ export function introspectionFromSchema(
options?: IntrospectionOptions,
): IntrospectionQuery {
const optionsWithDefaults = {
specifiedByUrl: true,
directiveIsRepeatable: true,
schemaDescription: true,
...options,
Expand Down

0 comments on commit 4da6b13

Please sign in to comment.