I am migrating from express-validation with joi@14 to celebrate with @hapi/joi@15.1.0. Everything except for one thing is going smoothly.
I try to output an error in the format:
[
{ field: 'state', message: '"grant_type" is required' },
{ field: 'state', message: '"user_id" is required' },
{ field: 'state', message: '"stream_id" is required' },
{ field: 'state', message: '"node_id" is required' }
]
I attach a custom error handler to the router and parse the incoming error. In express-validation you get an error array with all necessary information. With celebrate I only get one single error. It looks like this:
node
version - 10.16.0celebrate
version - 10.0.1joi
version (vianpm ls --depth=0 | grep joi
) - @hapi/joi@15.1.0My
joi
schema looks like this:Here is an example value that is not working as expected:
The issue I am having with
celebrate
is:I am migrating from
express-validation
withjoi@14
tocelebrate
with@hapi/joi@15.1.0
. Everything except for one thing is going smoothly.I try to output an error in the format:
I attach a custom error handler to the router and parse the incoming error. In
express-validation
you get an error array with all necessary information. With celebrate I only get one single error. It looks like this:Is it possible to get all errors or do you only get one?