-
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
Coercion is attempted on argument values but not on variable values. #123
Comments
Thanks for the report. What should happen here is the variables provided should also have required The values mapped to the enums are for internal use only and should not be leaked outside of the graphql public facade. |
Ahh, I see. If the variable were a primitive type (i.e., not requiring coercion) would it be ok to embed the value in the mutation itself rather than the params object? If so, it seems a bit inconsistent to have this distinction and I would prefer the condensed [inline] syntax; i.e., params-less, behavior for both primitives and coerced values. |
I'm not sure what you're referring to by primitive in this sense. All scalars in GraphQL go through a coercion step. The issue here, as I understand it, is that enum coercion from variables is currently incorrect.
|
Coercion to enum from string is a separate issue (filed separately). This current issue is simply that your first code example does not in fact work. However if the type of 'color' were changed to string (i.e., a primitive rather than a user-defined type), then it would work.
|
Thanks for the report, I will write a new suite of tests to ensure the correct behavior. |
Sorry, actually it is your second and third cases which demonstrate the current issue and, if this issue were fixed, then #1 would demonstrate the other one. |
And, you're welcome! Thanks for all of your work on GraphQL as well! 😀 |
To be clear, that was the bug. We were leaking the internal representation (sometimes ints) through to the external API. The test suite verified that bug existed, and the fix 2cf2f4c#diff-15f6b6c92ff954f80995d31726f89851R655 replaced parsing the variables as an internal representation with the external representation, as specified. |
Got it. And also my previous comment here was misguided as the failure for the fix to #122 to apply for me seems to be a bug in my code at this point, Will keep you posted if I eliminate that possibility. |
Schema:
This doesn't work:
while this does:
Server:
The text was updated successfully, but these errors were encountered: