You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What are you trying to achieve or the steps to reproduce ?
constmyValidator=Joi.string().trim().regex(/someregex/).error(errors=>{leterror=errors[0];if(error.type==='string.regex.base'){error.message='my new error message'}returnerrors;})let{ error, value }=Joi.validate(input,{field1: Joi.array().items(myValidator.min(2).max(64)),field2: myValidator})
Which result you had ?
When there is an error in field2 (not array), I am getting what I expected.
But when there is an error inside the array (field1), error is null while value will look like:
{field1: [// instance of Report with properties such as isJoi, context, message, etcisJoi: {...}],field2: 'original value'}
What did you expect ?
let{ error, value }=Joi.validate(input,{field1: Joi.array().items(myValidator.min(2).max(64)),field2: myValidator})
I expect error to be the error message
The text was updated successfully, but these errors were encountered:
Context
What are you trying to achieve or the steps to reproduce ?
Which result you had ?
When there is an error in field2 (not array), I am getting what I expected.
But when there is an error inside the array (field1),
error
is null whilevalue
will look like:What did you expect ?
I expect
error
to be the error messageThe text was updated successfully, but these errors were encountered: