arb / celebrate

A joi validation middleware for Express.
MIT License
1.33k stars 66 forks source link

Option for Celebrate to not short-circuit request validation #178

Closed ekrresa closed 4 years ago

ekrresa commented 4 years ago

I'm wondering if you could add an option for celebrate to get all possible errors before moving to the error handler. The current implementation renders the abortEarly option from Joi redundant

arb commented 4 years ago

Are you asking for an option so that if there are validation errors in headers, body, and query that you want all of them reported together rather than failing fast on headers?

ekrresa commented 4 years ago

Yes, please. I would like that very much

superh2m commented 4 years ago

+1 for this feature :pray:

TarineM commented 4 years ago

+1

cabardos commented 4 years ago

+1

Arthurhall commented 4 years ago

+1

arb commented 4 years ago

I've been thinking about this and it's a pretty big change. It would change the shape of the error object so that's breaking. Would the response be a object where the key is the failed segment and the value would be a CelebrateError? That would be the value even with this disabled for consistency.

arb commented 4 years ago

I've started working on this in #185. For those of you interested in this feature, check out my draft PR and leave any questions or concerns.

arb commented 4 years ago

Anyone here interested in reviewing #185? I think it's ready to go.