Thanks for your proposals, David J. M. Karlsen and Thibault Kruse! I've prepared API and spec changes for this for BV 2.0:
I'm adding the path and error message, e.g. like so:
javax.validation.ConstraintViolationException: manufacturer: may not be null, licensePlate: size must be between 2 and 14
I'm not adding "property" or similar, as the violation could also be for a parameter or class-level constraint. I went for a single line representation as that's better digestable when analysing/parsing log files. I think that condensed form a good default implementation. Of course integrators can still pass a longer, more detailed message, as e.g. the validation interceptor used for CDI is doing it. Happy about any feedback! |