Skip to content

Commit

Permalink
Revert "Remove all 'instanceof GraphQLSchema' checks" (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed May 5, 2016
1 parent 71df461 commit 2ac41f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/execution/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export function execute(
operationName?: ?string
): Promise<ExecutionResult> {
invariant(schema, 'Must provide schema');
invariant(
schema instanceof GraphQLSchema,
'Schema must be an instance of GraphQLSchema. Also ensure that there are ' +
'not multiple versions of GraphQL installed in your node_modules directory.'
);

// If a valid context cannot be created due to incorrect arguments,
// this will throw an error.
Expand Down
4 changes: 4 additions & 0 deletions src/utilities/extendSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ export function extendSchema(
schema: GraphQLSchema,
documentAST: Document
): GraphQLSchema {
invariant(
schema instanceof GraphQLSchema,
'Must provide valid GraphQLSchema'
);

invariant(
documentAST && documentAST.kind === DOCUMENT,
Expand Down
5 changes: 5 additions & 0 deletions src/validation/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export function validate(
): Array<GraphQLError> {
invariant(schema, 'Must provide schema');
invariant(ast, 'Must provide document');
invariant(
schema instanceof GraphQLSchema,
'Schema must be an instance of GraphQLSchema. Also ensure that there are ' +
'not multiple versions of GraphQL installed in your node_modules directory.'
);
const typeInfo = new TypeInfo(schema);
return visitUsingRules(schema, typeInfo, ast, rules || specifiedRules);
}
Expand Down

0 comments on commit 2ac41f6

Please sign in to comment.