Make clear whether the static or the runtime type should be considered when creating property paths in case of cascaded validations

Description

As of version 1.0 the specification does not clearly state, whether the static or the runtime type of an association should be considered when creating property paths in case of cascaded validations.

Let there be the following type:

When validating an instance of Foo (which has invalid elements in bar1/bar2) with the RI, the resulting property path node for bar1 would be iterable but not indexable ("bar1[]"), while the property path node for bar2 would be iterable and indexable ("bar2[123]"). This is that way because the static type of bar1/bar2 (Collection vs. List) is considered by the RI when building the nodes, and not the runtime type (ArrayList in both cases).

According to a post [1] on the Hibernate Validator forum Apache's JSR 303 implementation follows the runtime type approach. This seems reasonable to me, too (as for instance the constraints to validate are also determined based on the runtime type of references).

The specification should make clear what the intended behavior is and provide a TCK test case.

[1] related forum post: https://forum.hibernate.org/viewtopic.php?f=9&t=1010626
[2] related discussion on hibernate-dev: http://lists.jboss.org/pipermail/hibernate-dev/2011-April/006357.html

Environment

None

Activity

Show:
Gunnar Morling
September 26, 2011, 10:49 PM

Must have.

Hardy Ferentschik
May 31, 2012, 1:00 PM

FYI, Hibernate Validator already does this now already -

Fixed

Assignee

Emmanuel Bernard

Reporter

Gunnar Morling

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

Priority

Major
Configure