kristianmandrup / schema-to-yup

Schema to Yup validation
Other
281 stars 51 forks source link

Fix presentConstraintValue validator handler #93

Closed syastrebov closed 2 years ago

syastrebov commented 2 years ago

For the range constraints (min, max) field value isn't being passed to the constraint validator and it always calling nonPresentConstraintValue constraint handler which is wrong as well as for the other scalar values where this.addConstraint(name, { method, value }); is used.

Schema

{"core_tickets_lock_lifetime":{"type":"number","min":900}}
{"errMessages":{"core_tickets_lock_lifetime":{"min":"admin.validation.minimum_lock_duration"}}}

See attached screenshots before and after the fix

Screenshot 2021-10-27 at 13 47 27

Screenshot 2021-10-27 at 13 38 18