Description
Currently this query which would fail validation due to the All Variable Usages Are Allowed rule's explicit validation steps:
type Query {
dummy (arg: [String]): String
}
query ($arg: String) {
dummy(arg: $arg)
}
This is because of the text:
Otherwise, if locationType is a list type:
- If variableType is NOT a list type, return false.
However, the following queries are fine because of list input coercion rules:
query {
dummy(arg: "test")
}
and
query ($arg: [String]) {
dummy(arg: $arg)
}
# variables: { "arg": "test" }
Because of the text:
If the value passed as an input to a list type is not a list and not the null value, then the result of input coercion is a list of size one, where the single item value is the result of input coercion for the list’s item type on the provided value (note this may apply recursively for nested lists).
I propose modifying the All Variable Usages Are Allowed rule to allow for passing a scalar or input object to a list type (if the child type matches of course), and thereby allowing the query at the top of this feature request. I could write a PR if desired. It would be a fully backwards-compatible feature.