kristianmandrup / schema-to-yup

Schema to Yup validation
Other
283 stars 50 forks source link

Previously working required message, drops when combining refValueFor #152

Closed jamieBUK closed 1 year ago

jamieBUK commented 1 year ago

Working in version 1.12.13 Config: { "config": { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "currentPassword": { "type": "string", "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])\\S{8,99}$" }, "newPassword": { "type": "string", "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])\\S{8,99}$" }, "confirm_password": { "type": "string", "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])\\S{8,99}$", "refValueFor": "newPassword" } }, "required": [ "currentPassword", "newPassword", "confirm_password" ] }, "errorMessages": { "currentPassword": { "required": "Enter your current password", "pattern": "Please enter a valid password" }, "newPassword": { "required": "Enter a new password", "pattern": "Please enter a valid password" }, "confirm_password": { "required": "Enter a confirm password", "pattern": "Please enter a valid password", "refValueFor": "Confirm password field must have the same value as New password" } } }

in versions above 1.12.13 confirm_password's required message, gets dropped and the following now appears: 'confirm_password is a required field'