juniper
juniper copied to clipboard
Improve input object validation error messages
When an input object is validated and a field is missing or fails parsing then a general error message is returned to the client:
Invalid value for argument "foo", expected type "Foo!
This behavior can also be observed in this test.
From a client's perspective it is essential to know which field is missing/is failing to parse such that it can give appropriate feedback for the user's input. Therefore, I think that the error messages for input object validation should behave analogous to how it is the case for output objects where FieldResult is used to propagate such errors back to the client.
Example: I'm proposing the test to assert something like
"ExampleInputObject!" field "b" missing
instead of
"Invalid value for argument "arg", expected type "ExampleInputObject!"
Great idea!
I was able to resolve this by migrating to async-graphql.
Leaving this still open, as something that could be improved.