Description
Consider the following trivial schema:
type QueryRoot {
field(argument: Int!): Int!
}
And the following query against this schema:
query foo($variable: Int = 10) {
field(argument: $variable)
}
Even though $variable
is nullable, the fact that it has a default value explicitly allows it to be used for argument
which is non-null (https://facebook.github.io/graphql/#sec-All-Variable-Usages-are-Allowed).
Now consider what happens if I pass an explicit null for the value of $variable
(e.g. { "variable" => null" }
). This is in the spec as being semantically different from not providing the variable at all (https://facebook.github.io/graphql/#sec-Null-Value) so it would not be correct to use the default value. Variable validation is run against the actual type of the variable which is nullable, so it must pass (https://facebook.github.io/graphql/#sec-Coercing-Variable-Values). But the variable usage is also already validated, since it doesn't take into account the actual variable value when it's run.
This is clearly wrong (you end up with a null value used for a non-null argument) but it is not clear to me what part of the validation process is supposed to fail here?
cc @rmosolgo