Closed boldt closed 9 years ago
I've been waiting to update the joi-validation-strategy to account for nested object structures and arrays. I'll make this a priority to resolve. The real issue is with the naive formatting of errors by the strategy.
We can track this issue here and I'll reference this issue on the strategy side on check-in.
Thanks for the detailed report.
This has been fixed with 5.2.0: https://github.com/jurassix/react-validation-mixin/releases/tag/v5.2.0
Ensure you upgrade joi-validation-strategy to v0.2.1
Perfect. this.props.getValidationMessages('data')
returns a list of errors now. Thank you!
This bug is related to #39 (The index of an incorrect array entry is returned instead of the field name)
Observtion: The errors object returned by
joi-validation-strategy
does look like this:Thus,
this.getValidationMessages('data')
is emtpy, whilethis.getValidationMessages('data.0')
,this.getValidationMessages('data.1')
,this.getValidationMessages('data.2')
are set.My current workaround: Limit the numer of elemenets and then call:
Instead of:
This can be also an issue for the
joi-validation-strategy
[Edit] The paths
data.0
,data.1
, ... are produced by Joi, and thus mapped 1:1.