[Hibernate-JIRA] Created: (BVAL-72) Validating an object multiple times if in a different branch of the graph
by Emmanuel Bernard (JIRA)
Validating an object multiple times if in a different branch of the graph
-------------------------------------------------------------------------
Key: BVAL-72
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-72
Project: Bean Validation
Issue Type: Improvement
Components: spec-general
Reporter: Emmanuel Bernard
3-F) 3.5.1 "The InvalidConstraint objects reflect the path to reach the
object from the root validated object": What happens if the same invalid
object is referenced twice by an object (see the example below). Will
there be generated two InvalidConstraint objects one reflecting the path
b.ref1.value and one for b.ref2.value? If the referenced invalid object
is only validated once, which property path will be used?
class A {
@NotNull String value = null;
}
class B {
@Valid A ref1;
@Valid A ref2;
}
b = new B();
b.ref1 = new A();
b.ref2 = ref1;
Only one ConstraintViolation is created.
from 3.1.3
The @Valid annotation is applied recursively. A conforming
implementation avoids infinite loops by validating an
object the first time it is encountered in the graph, and ignores it
if it is encountered through at different path.
The path chosen is not defined. Any alternative?
Fine with me, I just wanted to have that clarified.
I thought about that a bit.
We have the current rule wich is simple but a bit indeterministic in the case an object is referenced twice in an object graph
Or we could adopt the following rule
For a given object graph branch, the same instance cannot be validated several times.
This would lead to the validation of the same object several times provided it is in different branches
in Sebastian's example
b.ref1 and b.ref2 would be validated and generate the same constraintViolations (with different paths)
Opinions?
- only one validation pass per instance (with some indeterminism)
- several validation pass and error reports provided that the object graph branches are different?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[Hibernate-JIRA] Created: (BVAL-59) Rethink the group sequence inheritance rules
by Emmanuel Bernard (JIRA)
Rethink the group sequence inheritance rules
--------------------------------------------
Key: BVAL-59
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-59
Project: Bean Validation
Issue Type: Improvement
Components: spec-general
Reporter: Emmanuel Bernard
Sebastian wrote:
3-F) 3.4 "Two group sequences must not share the same group name in a
given object graph". Does this mean If an object of type A references an
object of type B and A and B have a group sequences with the same name
this would result to an exception? Why would such a limitation be
necessary? Or is the term "object graph" misplaced here?
Emmanuel replied:
"When an object graph is validated (through the use of @Valid), the children elements of the graph inherit the sequence definitions of their parent."
Yes this was the intend. Because group sequence definitions are inherited from a parent to a child, the rule makes sense.
I think you assumed that a group sequence was not inherited. Children would be validated against the expanded groups of their parents.
Let's go back to the drawing board (in a different thread) and evaluate the merit of both rules using common usecases.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months