Skip to content

Commit 2ac41f6

Browse files
committed
Revert "Remove all 'instanceof GraphQLSchema' checks" (#377)
1 parent 71df461 commit 2ac41f6

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/execution/execute.js

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ export function execute(
117117
operationName?: ?string
118118
): Promise<ExecutionResult> {
119119
invariant(schema, 'Must provide schema');
120+
invariant(
121+
schema instanceof GraphQLSchema,
122+
'Schema must be an instance of GraphQLSchema. Also ensure that there are ' +
123+
'not multiple versions of GraphQL installed in your node_modules directory.'
124+
);
120125

121126
// If a valid context cannot be created due to incorrect arguments,
122127
// this will throw an error.

src/utilities/extendSchema.js

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export function extendSchema(
9494
schema: GraphQLSchema,
9595
documentAST: Document
9696
): GraphQLSchema {
97+
invariant(
98+
schema instanceof GraphQLSchema,
99+
'Must provide valid GraphQLSchema'
100+
);
97101

98102
invariant(
99103
documentAST && documentAST.kind === DOCUMENT,

src/validation/validate.js

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export function validate(
5353
): Array<GraphQLError> {
5454
invariant(schema, 'Must provide schema');
5555
invariant(ast, 'Must provide document');
56+
invariant(
57+
schema instanceof GraphQLSchema,
58+
'Schema must be an instance of GraphQLSchema. Also ensure that there are ' +
59+
'not multiple versions of GraphQL installed in your node_modules directory.'
60+
);
5661
const typeInfo = new TypeInfo(schema);
5762
return visitUsingRules(schema, typeInfo, ast, rules || specifiedRules);
5863
}

0 commit comments

Comments
 (0)