Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introspectionFromSchema: enable 'specifiedByUrl' by default #2852

Merged
merged 1 commit into from Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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