When you provide an unknown field as if it were a list, rather than getting an error stating the field does not exist, you get the following error:
Argument 1 passed to GraphQL\Type\Definition\Type::getNullableType() must be an instance of GraphQL\Type\Definition\Type, null given, called in /src/vendor/webonyx/graphql-php/src/Validator/Rules/ValuesOfCorrectType.php on line 75
For example, I have this input type:
input SomeInput {
name: String!
}
And in the query you add an unknown field like this:
{
name: "Example"
unknown: [
]
}
You'll get the error mentioned above.
However, if you add the unknown field like this:
{
name: "Example"
unknown: "Foo"
}
You simply get an error message stating "Field \"unknown\" is not defined by type SomeInput."
I would expect in both cases to get the error "Field \"unknown\" is not defined by type SomeInput.".
Steps to reproduce
Create any input type
Provide an extra field that is not present in the input type, and make it's value a list
Please open an issue with the upstream library https://github.com/webonyx/graphql-php. We can fix it in Lighthouse by updating our dependency after it has been fixed there.
When you provide an unknown field as if it were a list, rather than getting an error stating the field does not exist, you get the following error:
Argument 1 passed to GraphQL\Type\Definition\Type::getNullableType() must be an instance of GraphQL\Type\Definition\Type, null given, called in /src/vendor/webonyx/graphql-php/src/Validator/Rules/ValuesOfCorrectType.php on line 75
For example, I have this input type:
And in the query you add an unknown field like this:
You'll get the error mentioned above.
However, if you add the unknown field like this:
You simply get an error message stating "Field \"unknown\" is not defined by type SomeInput."
I would expect in both cases to get the error "Field \"unknown\" is not defined by type SomeInput.".
Steps to reproduce
v5.6.0