-
Notifications
You must be signed in to change notification settings - Fork 25
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
Validate schema #68
Comments
I've agreed with Miles to take a look at this issue. |
Mostly done in #68. There are a few additional things we could add. For instance checking that a object type defines all the members specified by the interfaces it implements. |
Was wondering what is left to do here? Happy to have a go at contributing further validation if there is more required. |
I think probably needs a quick review of the spec before closing. |
Currently there's no validation of schemas beyond basic syntactic well-formedness. Consequently it's possible to construct schemas with references to undefined types (typically due to a typo in the definition or use) or multiple definitions (eg. I've accidentally defined a first as a scalar then as an enum, but forgotten to remove the first definition). Invalid schemas of this sort can result in all sorts of confusing runtime failures later.
The GraphQL spec has a fairly comprehensive list of validation criteria for queries. The validation criteria for schemas is less explicit and spread throughout section 3 of the spec: https://spec.graphql.org/June2018/#sec-Type-System. In practice I think that checking for references to undefined or multiply defined types will cover the most common issues.
GraphQL schemas are represented as values of the
Schema
types and the validation above would be a matter of checking theNamedType
elements of itstypes
member for consistency and completeness.The text was updated successfully, but these errors were encountered: