-
Notifications
You must be signed in to change notification settings - Fork 822
Description
When making a query with multiple arguments with variables and literals, the query will fails as soon as it comes to a literal, if it's a type that implements parse_literal that does not accept an additional _variables parameter.
Steps to reproduce
Define a schema with an attribute taking two arguments.
Execute a query with the two arguments only one of which is set by a variable value the other by a literal value.
query = """
query Test($a: GenericScalar){{
generic(inputA: $a, inputB: "foo")
}}
"""
The query fails with an error GraphQLError("Argument 'inputB' has invalid value 'foo'."event though 'foo' is a valid value for inputB.
What is the expected behavior
Since it's a valid query it's supposed to not return an error.
Solution
python-graphql/graphql-core proposes a strict API for Scalar-types all of which implement the parse_literal method accepting a second parameter for _variables
graphene's Scalar-types should respect the API if it inherits from graphql-core type classes and accept kwarg _variables=None