Skip to content

Check all errors on joi.assert and joi.attempt #1722

Closed
@jsardev

Description

@jsardev

Describe the problem you are trying to fix (provide as much context as possible)

I would like joi.assert and joi.attempt to return all the errors found in the validating object and not throwing just the first one noticed.

Which API (or modification of the current API) do you suggest to solve that problem ?

joi.validate has this exact option via abortEarly: false. Unfortunately, I don't like the API of this method as I can't just do a try/catch or anything similar and I always need to do if(valid.error === null) check and throw the error manually which feels very cumbersome. joi.assert and joi.attempt methods could have the same option to make the API consistent.

Are you ready to work on a pull request if your suggestion is accepted ?

Unfortunately, I'm in the middle of a big project and already missing some deadlines and I can't work on it right now 😢 Although I could be available in 2 months to take a look on it.

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions