[bv-dev] Promote fail fast?

Emmanuel Bernard emmanuel at hibernate.org
Tue Aug 30 04:42:52 EDT 2016


I don't think a n option would make sense.
One that might make sense is to keep validating a failing field with the
remaining constraints before stopping to at least have a comprehensive
view of the failure especially when constraints are composed.

Emmanuel

On Tue 2016-08-30  8:48, Gunnar Morling wrote:
> Hi Marco,
> 
> Thanks for bringing up this proposal. I think it'd be a good addition. Can
> you open a BVAL issue for it?
> 
> A variation could be to not stop after the first failure but after the
> first n, with n being a configurable number. I can't see a compelling use
> case for this, though. Usually you just want a quick exit if an object is
> invalid, so a binary setting should do it.
> 
> @Others, any thoughts from your side?
> 
> Cheers,
> 
> --Gunnar
> 
> 
> 2016-08-29 7:38 GMT+02:00 Marco Molteni <moltenma at gmail.com>:
> 
> > Hi guys,
> >
> > What do you think about the 'promotion' of fail-fast (from hibernate
> > validator) to the BV API?
> >
> > I see frequently this 2 use cases (in the 9-5 projects) to support the
> > request ;)
> >
> > 1. batch: there are a lot of batch processes that have to validate the
> > input data (flat file -> bean -> validation) and return for each bean only
> > a technical error if at least one field is not valid ('input refused').
> > When there are millions (e.g. payments transactions) of beans to validate
> > in a batch and 30-50 fields for each bean the fail-fast saves a lot of time
> > (and the night is never long enough for all the batches required) ;)
> >
> > 2. REST response: in the validation of REST services often when 2 systems
> > exchange data the answer in case of error is an HTTP 4xx without many
> > details. The fail-fast is a time and machine resources saving when your
> > application is accessed by (hundred of) thousand users through some
> > external web client (e.g. JS client).
> >
> > In the do-it-yourself implementations for the 2 uses cases at the first
> > error an IllegalArgumentException is thrown with the information of the
> > first error found.
> >
> > The full test of every field is very well suited for uses cases in which
> > there is a human to machine communication (e.g. web forms).
> >
> > If your opinion is positive I can do more investigations if needed.
> >
> > Cheers
> >
> > Marco
> >
> > _______________________________________________
> > beanvalidation-dev mailing list
> > beanvalidation-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
> >

> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev



More information about the beanvalidation-dev mailing list