Open chrisjowen opened 7 years ago
@chrisjowen were you able to resolve this?
@dwhelan I'm ssuming that since this issue is about two years old, I don't have much hope of a resolution in this case, huh?
I realize that since this question has been asked hoverboards have been invented.. however, the following seems to work well for me (so far):
validates :nested, &Vex.validate/1
.validate
instead of .valid?
to propagate the error message. This works for me since my nested struct implements use Vex.Struct
. Otherwise I noticed nested fields are somewhat supported: https://github.com/CargoSense/vex/blob/e92330d2ef2cdaa80b9abdc00c8db867b42dc971/test/validations/nested_test.exs#L33
Hey, nice library. Im wondering if its possible to expose the errors for nested structs currently I am using the
Vex.Struct
module and defining a custom function for validating a nested structure i.e.validates :nested, &NestedVexStruct.valid?/1
This works great and gives me the ability to run the nested validations but if it fails the error I get is only associated with this top level validator and not the actual causes in the sub validator. Any ideas around this?