when passing vars to an attribute with multiple args make sure parse_literal
consumes at least 2 params
#169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
This PR addresses the problem I encountered when querying with filter-variables with a list of filter arguments
of which at least one value is a scalar type that does not interpolate any variable. At the
parse_literal()
call sitethe test for existence of
variables
is misleading resulting in a false return ofUndefined
because of a mismatchof
parse_literal()
signatures of different types, some takingvariables
as a second parameter, some not (e. g.graphene.types.generic.GenericScalar
. In any case the presence of variables is not a sufficient criteria.Solution:
variables
may be passed to a scalar type that does not do anything with them. We assume that the scalar is still a valid case that should not evaluate toUndefined
. In order to disregard the passedvariables
we check for the implementedparse_literal()
method to actually consume a second parameter.Example case: evaluation of a
GraphQLList
type that recurringly invokesparse_literal
passing the same
variables
regardless of whether the variables passed actuallyare relevant for the scalar currently evaluated.