-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add descriptive value validation errors #811
Add descriptive value validation errors #811
Conversation
…ve-value-validation-errors
Thanks for the PR! Are there perf implications of this change? |
Sorry for the late response, and thank you for updating this branch! The only performance implications I'm aware of would be for errors that are nested fairly deep within a graph. For example, an error on a GraphQL object nested 10 levels deep would have the error bubble up to each of the 10 levels, and create a new error string each time to help pinpoint the error's location. If this is undesirable (since it could create larger errors for larger graphs), an alternate solution could be to have an enum for the different types of validations, and not build upon errors for objects or lists. This would ensure everything else would bubble up to an object or list, so the relative location of the error would be known, but the error wouldn't grow in size if it was deeply nested. The second solution would be more performant since it wouldn't need to create as many strings on larger graphs, but at the cost of less information to locate an error. Are there any performance implications you're wondering about specifically? |
@zaksabeast do you plan to continue work on this PR? |
…tive-value-validation-errors
@toxeus, sorry for the late response. I'm up for continuing this PR, although I'm not quite sure what changes are needed. |
This looks like a very valuable addition to Juniper. @LegNeato is there a particular reason why this isn't moving forward? ('I'm too busy' is a totally acceptable answer, I use it frequently) |
Perhaps @tyranron you can shine your light on this? |
@haarts definitely not the first thing on my agenda, but I'll try to include this into new |
@haarts @tyranron I think this would be a great addition for the next release. It feels inapt that |
# Conflicts: # juniper/src/types/utilities.rs # juniper/src/validation/rules/arguments_of_correct_type.rs # juniper/src/validation/rules/default_values_of_correct_type.rs
This was done in #987. |
Fixes: #693
This pull request adds descriptive errors when validating argument and default values.
For example, an input object missing a field would show
Error for argument "arg": "ExampleInputObject" is missing fields: "b"
.If there's a different approach you'd like to take for this, I'd be happy to implement that as well.