Yes, I've faced scenarios where fail-fast would have been very useful.
BVAL-214 should take this into account too if we move forward with
this proposal.
Regards,
Michael
On Mon, Aug 29, 2016 at 2:38 AM, Marco Molteni <moltenma(a)gmail.com> wrote:
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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev