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
Coercing variables #115
Comments
Okay, so we cleared it with @leebyron. I'll try to make a PR asap. |
Merged in! this will be in the next release. |
These changes should reflect onto the docs: http://graphql.org/docs/api-reference-type-system/#graphqlscalartype When playing with graphql-js, I got super confused on why |
Currently Scalar types have two methods
coerce
andcoerceLiteral
.coerceLiteral
is used to create a javascript value from ast,coerce
is used both on variables and on data received from resolve in executors.Unfortunately that is not enough - variables usually come from some format like
json
which wouldn't always support all the new scalar types and most likely will return them as string. On the other hand, eg, databases might return types in javascript format already. Thereforecoerce
can't support both variable coercion and execution coercion.@leebyron suggested that for variable coercion, a new method is added to the Scalars -
coerceVariable
.The text was updated successfully, but these errors were encountered: