Keats/validator

Can no longer use multiple custom validations on one field with 0.17

divergentdave opened this issue · 5 comments

I have some struct fields where I apply multiple custom validations. This worked in 0.16, but no longer works after the derive macro rewrite in 0.17. I now get the error message error: Duplicate field `custom` . Granted, I could create another custom validation function that composes the two, but I think this is an unnecessary burden to reuse of custom validations.

That should be added back

Ok that should be fixed in #304

I think the fix in 0.18 is incomplete. If I comment out the can_validate_custom_fn_ok test in validator_derive_tests/tests/custom.rs, then rustc reports that valid_custom_fn() is unused. This indicates that, in the test can_validate_multiple_custom_fn_ok below, the first of two custom validators is ignored.

Argh, I guess it needs more tests

That's a facepalm worthy bug, you can see the diff above