-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Remove all 'instanceof GraphQLSchema' checks #371
Conversation
Yeah, those invariants were probably a little over-protective. I think this is fine. |
See the revert - this actually caused problems :( |
* master: (26 commits) 0.6.0 Validation: improving overlapping fields quality (graphql#386) Validation: context.getFragmentSpreads now accepts selectionSet rather than fragment AST node Factor out more closure functions Factor out closure functions to normal functions Deprecated directive (graphql#384) RFC: Directive location: schema definition (graphql#382) RFC: Schema Language Directives (graphql#376) Export introspection in public API Export directive definitions. (graphql#381) BUG: Ensure building AST schema does not exclude @Skip and @include (graphql#380) documentation of schema constructor Revert "Remove all 'instanceof GraphQLSchema' checks" (graphql#377) remove all 'instanceof GraphQLSchema' checks (graphql#371) Error logging for new interface type semantics (graphql#350) Nit: Missing case in grammar for TypeSystemDefinition in comment Bug: printer can print non-parsable value Factor out suggestion quoting utility Minor refactoring Minor refactoring of error messages for unknown fields ...
@helfer I just ran into issues with this when I Would linking the same |
@rdrey yes, that should do the trick. But to be honest, sometimes I found it to be faster to use |
Also, FWIW: I would now solve the problem that this PR was supposed to help with by extending the base classes from graphql-js in my own package, if I needed to. |
This change removes the instanceof GraphQLSchema checks in validate and execute. This makes graphql-js play more nicely with schemas generated by other libraries, or even schemas created by other versions of graphql-js as long as they are compatible (a common issue with npm v2).
@leebyron Right now I just removed the checks and didn't replace them with anything, because it turned out that no tests were affected by the change. Let me know if you think we should have some duck typing checks in there, such as checking that getTypeMap, get Type, getQueryType, getDirectives etc. are functions.