Open gonzedge opened 2 weeks ago
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.
but honestly the whole error types need to be rewritten, it's super confusing imo
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.
So.. I think I have a solution (note that child is a quick and dirty test just so I can test it out). This does have the issue though of conflicting with a different field called a_child.
Seems like options are:
Pros:
Cons:
Pros:
Cons:
Pros: -Clean and permament
Cons:
IMO 3 is the way to go for a long term fix but putting out the options out there (we could put out 1 asap as a mitigation for people first if we want)
Option 3 was much easier to implement than expected: https://github.com/Keats/validator/pull/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): https://github.com/Keats/validator/blob/1728fd7a6b17a200141b820f5bc7e6fc5088ff65/validator_derive_tests/tests/nested.rs#L85-L130
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: