-
Notifications
You must be signed in to change notification settings - Fork 156
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
Issue: Panic when trying to use custom validators combined with nested validators #357
Issue: Panic when trying to use custom validators combined with nested validators #357
Conversation
It's in /~https://github.com/Keats/validator/blob/master/validator/src/types.rs#L181-L187 but honestly the whole error types need to be rewritten, it's super confusing imo |
Interesting, I have a pretty similar case that doesn't panic. Will experiment it a bit more to see if I can find out why and how to get a solution. So far I got that it has to be multiple validates in the nested. |
LOL. My initial thought is: would it be possible to use the list type in all cases and make it so that any resulting errors (whether one or multiple, nested or not) can be appended to a list within the underlying hash map? I took a stab at it but it got outta hand pretty quickly. |
Option 3 was much easier to implement than expected: #359 I didn't include the test since it should be merged from this PR but I did copy and paste it and it runs fine. |
While trying to use a combination of nested and custom validators, I've been getting
panic
s with the messageAttempt to replace non-empty ValidationErrors entry
.I've boiled down the failing case to this minimum setup (contained within this PR):
validator/validator_derive_tests/tests/nested.rs
Lines 85 to 130 in 1728fd7
I'm trying to get familiar with the code, but have been unable to correct the issue so far. Any help would be appreciated.
Full panic stack backtrace: