Given the attached sample project, I would like map the errors in an object like
As in my sample, my approach at the moment is by navigating the violation path (http://docs.oracle.com/javaee/7/api/javax/validation/ConstraintViolation.html#getPropertyPath--) which works perfectly for the first case, but fails for the second (I cannot find a way to retrieve the index of the failing object). I think the reason is in the implementation of javax.validation.Path.PropertyNode in hibernate-validator, which retrieves the index from the parent node. In my case, the failing object is a leaf, thus this approach cannot work.
Discussion started on SoF: http://stackoverflow.com/questions/39872625/type-use-annotation-in-hibernate-validator