Is it possible to relax
validation using jakarta validation groups
?
For example, for default configuration I have the following validations:
class Person {
@NotNull
private String name;
@NotNull
private String email;
}
Call without specifying validation group works as expected:
validator.validate(person) //validates name AND email
But for this case:
validator.validate(person, EmailNullable.class) //validates name ONLY
… I want only name to be validated, email
could be nullable.
Is it possible somehow define EmailNullable
validation group to relax default validations and suppress NotNull
for email
field?