Is @Valid supported in composite constraints

Description

I have been trying to get @Valid to work in a composite constraint but no luck so far. I went through HV documentation and searched online to find out if @Valid is not supported in composite constraints but I can't find any mention of that.

Here is a simple example that shows the issue:

So my question is this: Is @Valid supported in composite constraint? If not, can you please point me to some online resource that explains why.

My guess is that it's not supported for the following reason: @Valid does not support groups (i.e., if you have @Valid declared somewhere then cascade validation will always take place regardless of the validation group that was specified in/passed to the validator API call). On the other hand, composite constraints support groups/can be turned on/off by validating a bean for a specific group. If @Valid were to be placed in a composite constraint then you effectively make @Valid support groups (i.e., cascade validation will become group based rather than the mere presence/absence of @Valid constraint).

Any thoughts?

Environment

OpenJDK 14
Hibernate Validator 6.1.4.Final
SE environment

Assignee

Unassigned

Reporter

user

Labels

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Minor
Configure