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

Revert "Remove all 'instanceof GraphQLSchema' checks" #377

Merged
merged 1 commit into from
May 5, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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