I have an JavaDTO like:
public class myDTO {
private String name;
private Integer age;
}
I want to do different validation in Micronaut by an CREATE operation and by an UPDATE operation. In Spring you can define different 'groups' therefore. See here stackoverflow link or here external link. So this looks like:
public class myDTO {
@Null(groups = OnCreate.class)
@NotNull(groups = OnUpdate.class)
private String name;
@Null(groups = OnCreate.class)
@NotNull(groups = OnUpdate.class)
private Integer age;
}
Is there something similiar for micronaut there?