Skip to content

Commit fe4f8eb

Browse files
buildASTSchema: pass empty schema as literal (#2607)
Empty schema constructed as `new GraphQLSchema({ directives: [] })` still contains introspection types
1 parent 056a6e4 commit fe4f8eb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/utilities/buildASTSchema.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ export function buildASTSchema(
7272
assertValidSDL(documentAST);
7373
}
7474

75+
const emptySchemaConfig = {
76+
description: undefined,
77+
types: [],
78+
directives: [],
79+
extensions: undefined,
80+
extensionASTNodes: [],
81+
assumeValid: false,
82+
};
7583
const config = extendSchemaImpl(emptySchemaConfig, documentAST, options);
7684

7785
if (config.astNode == null) {
@@ -114,8 +122,6 @@ export function buildASTSchema(
114122
return new GraphQLSchema(config);
115123
}
116124

117-
const emptySchemaConfig = new GraphQLSchema({ directives: [] }).toConfig();
118-
119125
/**
120126
* A helper function to build a GraphQLSchema directly from a source
121127
* document.

0 commit comments

Comments
 (0)