-
-
Notifications
You must be signed in to change notification settings - Fork 140
GraphQLScalarType.parse_literal
is called with two arguments instead of one when Query variables are present.
#93
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
That |
The problem at runtime is that I have tried to mitigate the problem by adding better type hints in 0f81d95 (not sure why that comment said this was not possible - maybe because of the impedance mismatch when using the callable as a method, but that warning has been silenced anyway). |
I've did some experimenting with this and found that Could you please explain this behaviour? I'm updating Ariadne's docs on custom scalars knowing why this happens would help me a lot here. Thanks! |
The first time the The second time the This is all ported 1:1 from GraphQL.js. If your question is why they are actually passing the variables to |
I have now created graphql-js#2657 to clarify this issue. |
To sum up the current state: The |
Makes sense. Thanks for investigating this! |
It has been reported to us that when custom scalar with
parse_literal
is given literal value in query that has been called with variables, function passed toparse_literal
will be called with two arguments instead of one:ast
of literal and dict with query variables:This produces tricky to debug error, eg.:
However actual error is
TypeError
for function being called with two arguments instead of one.However GraphQL.js documentation doesn't mention this behaviour:
https://graphql.org/graphql-js/type/#graphqlscalartype
I've found that
value_from_ast_untyped
is called with two arguments in situation when query variables are present, but couldn't find anything about customparse_literal
.Is this intended?
The text was updated successfully, but these errors were encountered: