juniper icon indicating copy to clipboard operation
juniper copied to clipboard

Improve input object validation error messages

Open toxeus opened this issue 5 years ago • 3 comments

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!"

toxeus avatar Jul 08 '20 08:07 toxeus

Great idea!

LegNeato avatar Jul 16 '20 08:07 LegNeato

I was able to resolve this by migrating to async-graphql.

toxeus avatar Sep 01 '22 21:09 toxeus

Leaving this still open, as something that could be improved.

tyranron avatar Sep 02 '22 11:09 tyranron