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

Validation for query variables #15

Open
jsonmaur opened this issue Oct 20, 2016 · 0 comments
Open

Validation for query variables #15

jsonmaur opened this issue Oct 20, 2016 · 0 comments

Comments

@jsonmaur
Copy link

First of all, thanks a ton for this, it really helped me learn GraphQL. I wanted to suggest an addition in part 7 when you talk about creating custom scalar types for fine-grained validation. What you have there doesn't work at all if a query is using variables instead of arguments. That requires the validation to occur in parseValue instead of parseLiteral.

For example, if I have a custom scalar type defined using the docs you have currently (with only parseLiteral, this will be validated:

mutation {
  createUser (email: "invalidemail") { ... }
}

but this will not:

mutation signup ($email: Email!) {
  createUser (email: $email) { ... }
}

I'll submit a PR for this, hopefully it will clear things up for anyone using validation on queries with variables.

@jsonmaur jsonmaur changed the title Custom Scalar Type validation Validation for query variables Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant