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

Use validation helper to check if GraphQLSchema instance #1134

Closed
wants to merge 1 commit into from

Conversation

dwwoelfel
Copy link
Contributor

@dwwoelfel dwwoelfel commented Dec 11, 2017

Checks if schema is valid with the assertValidSchema helper instead of a simple instanceof check. This gives the developer actionable error messages when there are multiple versions of graphql in node_modules.

schema instanceof GraphQLSchema,
'Must provide valid GraphQLSchema',
);
assertValidSchema(schema);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good call to check this here - but I'm not sure we want to assert the whole schema is valid before extending it, we want to preserve the use case where you can extend an incomplete schema to get to a complete one.

I have an idea to extract just this check out, one sec while I test it out

leebyron added a commit that referenced this pull request Dec 12, 2017
Introduces new predicate and assertion functions for each kind of type mirroring the existing ones for the higher order types. It also includes predicates for directives and schema. This should remove the need to use `instanceof` in any usage of GraphQL.js

This consolidates the checking of instances which generalizes the cross-realm/multiple-module check so that the clearer error message is provided in nearly all scenarios, reducing confusion.

This also replaces nearly all `instanceof` with new predicate functions internally.

Fixes #1134
@leebyron leebyron mentioned this pull request Dec 12, 2017
leebyron added a commit that referenced this pull request Dec 12, 2017
Introduces new predicate and assertion functions for each kind of type mirroring the existing ones for the higher order types. It also includes predicates for directives and schema. This should remove the need to use `instanceof` in any usage of GraphQL.js

This consolidates the checking of instances which generalizes the cross-realm/multiple-module check so that the clearer error message is provided in nearly all scenarios, reducing confusion.

This also replaces nearly all `instanceof` with new predicate functions internally.

Fixes #1134
leebyron added a commit that referenced this pull request Dec 12, 2017
Introduces new predicate and assertion functions for each kind of type mirroring the existing ones for the higher order types. It also includes predicates for directives and schema. This should remove the need to use `instanceof` in any usage of GraphQL.js

This consolidates the checking of instances which generalizes the cross-realm/multiple-module check so that the clearer error message is provided in nearly all scenarios, reducing confusion.

This also replaces nearly all `instanceof` with new predicate functions internally.

Fixes #1134
leebyron added a commit that referenced this pull request Dec 12, 2017
Introduces new predicate and assertion functions for each kind of type mirroring the existing ones for the higher order types. It also includes predicates for directives and schema. This should remove the need to use `instanceof` in any usage of GraphQL.js

This consolidates the checking of instances which generalizes the cross-realm/multiple-module check so that the clearer error message is provided in nearly all scenarios, reducing confusion.

This also replaces nearly all `instanceof` with new predicate functions internally.

Fixes #1134
leebyron added a commit that referenced this pull request Dec 12, 2017
Introduces new predicate and assertion functions for each kind of type mirroring the existing ones for the higher order types. It also includes predicates for directives and schema. This should remove the need to use `instanceof` in any usage of GraphQL.js

This consolidates the checking of instances which generalizes the cross-realm/multiple-module check so that the clearer error message is provided in nearly all scenarios, reducing confusion.

This also replaces nearly all `instanceof` with new predicate functions internally.

Fixes #1134
leebyron added a commit that referenced this pull request Dec 12, 2017
Introduces new predicate and assertion functions for each kind of type mirroring the existing ones for the higher order types. It also includes predicates for directives and schema. This should remove the need to use `instanceof` in any usage of GraphQL.js

This consolidates the checking of instances which generalizes the cross-realm/multiple-module check so that the clearer error message is provided in nearly all scenarios, reducing confusion.

This also replaces nearly all `instanceof` with new predicate functions internally.

Fixes #1134
@leebyron leebyron deleted the better-schema-errors branch January 29, 2018 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants