-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add enum value validation in input object #109
Conversation
this rule is implemented in https://github.com/vektah/gqlparser/blob/master/validator/rules/values_of_correct_type.go#L71-L78 . |
so far, for the value is not in the enum list, it will return 422 error for the enum in argument, but 200 for the enum in the input object. eg.
for 422 Unprocessable Entity error
for 200
both will give errors, but I think it should also return same http status code? |
ah, make sense.
I tried it by
umm... This validation should execute in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I investigated this change again.
so, I mentioned ValuesOfCorrectType
rule before. but It's maybe not correct...
https://github.com/graphql/graphql-js/blob/7d24b050e2e321f2973a2de4d2834b8494a6945b/src/utilities/coerceInputValue.js#L197-L217
coerceInputValue
is it and validator/vars.go
is mapped to it.
currently, I think your implementations is maybe correct.
This will validate the enum value for the enum in input object