Skip to content

Commit

Permalink
Show all validation errors instead of aborting early
Browse files Browse the repository at this point in the history
  • Loading branch information
hagopj13 committed Jul 4, 2021
1 parent ab1ccbc commit 5466a6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/middlewares/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const validate = (schema) => (req, res, next) => {
const validSchema = pick(schema, ['params', 'query', 'body']);
const object = pick(req, Object.keys(validSchema));
const { value, error } = Joi.compile(validSchema)
.prefs({ errors: { label: 'key' } })
.prefs({ errors: { label: 'key' }, abortEarly: false })
.validate(object);

if (error) {
Expand Down

0 comments on commit 5466a6d

Please sign in to comment.