Marko Bekhta (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HV-1946 (
https://hibernate.atlassian.net/browse/HV-1946?atlOrigin=eyJpIjoiYWIwMmRl...
)
Re: PathImpl.createCopy() only performs a shallow copy (
https://hibernate.atlassian.net/browse/HV-1946?atlOrigin=eyJpIjoiYWIwMmRl...
)
I didn’t really know what I should have added as a node name so I just
guessed nothing.
Built-in value extractors (
https://jakarta.ee/specifications/bean-validation/3.0/jakarta-bean-valida...
) section in the spec describes the names used for built-in extractors. While you are not
required to pass a name … Hibernate Validator logic around nodes and paths was built with
the idea in mind that those iterable (multivalued) containers would have something as a
container element.
That’s why if you do not pass anything as a node name, it messes up not only the paths in
the constraint violations but also provides unexpected results when you call
isInIterable() / getIndex() …
The string for that node comes out as expected: componentValidatorText [0]
, but I expected that isInIterable() would return true and that
{{getIndex()}}would return 0. But, they do not.
as for this part … there’s a bit of explanation in the Javadocs. You can also take a look
at the Listing 6.4 of ConstraintViolation section (
https://jakarta.ee/specifications/bean-validation/3.0/jakarta-bean-valida...
). In short - both isInIterable() / getIndex() are intended for a container element and
not for the container itself. So if you have a path like componentValidatorText
[0].<some container element name> then <some container element name> node will
return isInIterable() == true / getIndex() == 0 but node componentValidatorText [0] will
be just considered a container so it is not in iterable and as a result doesn’t have an
index – isInIterable() == false / getIndex() == null
(
https://hibernate.atlassian.net/browse/HV-1946#add-comment?atlOrigin=eyJp...
) Add Comment (
https://hibernate.atlassian.net/browse/HV-1946#add-comment?atlOrigin=eyJp...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:5ff5564 )