-
Notifications
You must be signed in to change notification settings - Fork 1k
GraphQL: Improve documents validation before running execution flow #3013
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
Comments
Yes, that should be possible. The big question is what these tests check for, but this should be testable by adding to |
I checked in
I tested the following GraphQL schema: type Query {
a(b: String): String
} And the following GraphQL query: query test {
a(b: "1")
a(b: "2")
a(b: "3")
}
The error I got is:
When I'm skipping the @lutter I noticed that I guess we can take the query after it's being parsed and implement the validation rules that GraphQL spec defines, and run it before getting into the whole execution phase - this way we can find these specific issues before running any GraphQL-related code/resolver. The GraphQL spec / graphql-js implementation has ~30 validation rules that should cover most edge cases and prevent ambiguity during execution phase. Also it also has a spec for what does a validation rule means, and how developers can extend and write their own (we are doing similar things in @lutter what do you think? |
Continue from: #3005
I guess we can do that by adding unit tests? :)
The text was updated successfully, but these errors were encountered: