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
any other relevant information: Passing custom error instance to Joi().any().error()
What are you trying to achieve or the steps to reproduce ?
Describe your issue here, include schemas and inputs you are validating if needed.
constJoi=require('joi');constaddressSchema=Joi.object().keys({address: Joi.object().keys({pin: Joi.number().min(100000).max(999999).error(newError('pincode is missing')).required()}).error(newError('address is missing')).required()});letaddress={"action" : "xyz","address":
{"id": "1","title": 'Home'}}Joi.validate(address,addressSchema,(err,value)=>console.log(err));
Which result you had ?
address is missing
What did you expect ?
pincode is missing
The text was updated successfully, but these errors were encountered:
shashankbaluni
changed the title
In case of custom error messages passed Joi.any.error, joi.validate returning parent object error even if child validation fails.
In case custom error messages are passed to Joi.any.error, joi.validate returning parent object error even if child validation fails.
Jun 13, 2017
Context
What are you trying to achieve or the steps to reproduce ?
Describe your issue here, include schemas and inputs you are validating if needed.
Which result you had ?
address is missing
What did you expect ?
pincode is missing
The text was updated successfully, but these errors were encountered: