[bv-dev] Promote fail fast?

Marco Molteni moltenma at gmail.com
Tue Aug 30 17:01:25 EDT 2016


Hi Gunnar,

I will open a BVAL issue. Interesting the n option, but I didn't find any
concrete use case neither. As you said, usually the result expected is true
or false.

Cheers

On Tue, Aug 30, 2016 at 10:42 AM, Emmanuel Bernard <emmanuel at hibernate.org>
wrote:

> 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
>
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20160830/a5d2db27/attachment.html 


More information about the beanvalidation-dev mailing list