Gunnar wrote:
This node name is chosen to indicate that the violation relates to a constraint declared on the type argument of a generic container, which lets you tell it apart e.g. from a constraint on a property of that container element. One probably could achieve the same with the name being null for the container element constraint case, but we favored the more explicit approach.
It seems completely unambiguous to just end the property path with "collectionproperty[index]". In my code that uses the property path to render an error message, I'm specifically removing that string.
Gunnar wrote:
Note that in Bean Validation 2.0 / Hibernate Validator 6 there'll be a new node type (CONTAINER_ELEMENT), the node names will be standardized and there'll also be two new members on the relevant Node subtypes, getContainerClass() and getTypeArgumentIndex(), providing all the information to identify the location of the violated constraint.
If you look into using constraints on container element constraints, I'd recommend to try and use HV 6.0 as semantics have been clarified and partly changed in the course of adding this functionality to the specification. E.g. you can now have constraints on nested containers, too: Map<String, List<@Size(min=1) String>>.
Noted. I'll clearly have some porting work when/if we upgrade.