Reputation: 99
I am using joi for validating request like
lastName: Joi.string().trim().min(3).optional().error(new Error('Please enter valid name')),
email: Joi.string().email().required().lowercase().error(new Error('Please enter valid Email ID')),
it is working fine and i am also able to send error using failAction but if both validation fails it only send the first failed
like if you enter lastName as h , and email as S@@com so it send only first error i.e "Please enter valid name" but I want response containing both error
I also try to use failAction but after failing fist validator it ignore all other validator any suggestion how can i get the required result
Upvotes: 1
Views: 150
Reputation: 2398
set
abortEarly: false
in server setting by default it is true
server.connection({
routes: {
validate: {
options: {
abortEarly: false
}
}
}
});
Upvotes: 1