I have the same form that displays more or less fields depending on the user's role. So I use @JsonView to hide/ignore the fields that are not related to the current user's role. But the validation is still enabled and the @NotNull
rule is triggered.
@JsonView({View.Admin.class, View.Tech.class})
@NotNull
private String name;
I would like to find a way to enable or disable some validation annotations for example when the user's role is not administrator.
Is it possible to use these view (View.Admin.class
/ View.Tech.class
) as a group for validation please?