Description
Hi there,
I have recently come upon unexpected list coercion errors for [Enum] variable values.
The error occurs when the variable value is null
for no input value for the enum list.
query getUsers($userType: [UserType], $username: [String]){
getUsers(
userType: $userType
username: $username
){
userType
username
}
}
Variables
{
"userType": null,
"username": null
}
This results to
{
"errors": [
{
"message": "mismatched input value"
}
]
}
If I replace userType variable value to []
or [null]
, the error is gone. However, that will mean I am sending an empty list rather than a null which will impact resolver input value logic. I'd expect the null to be passed through and ignored in subgraph.
It seems that a null variable value for a [Enum] nullable input field does not work.
It does however work for [String], where I can provide a null variable value and it does not error.
The error is thrown in:
func (v *inputFieldDefaultInjectionVisitor) processObjectOrListInput(fieldType int, defaultValue []byte, typeDoc *ast.Document) ([]byte, bool, error)