I started to use validation framework @Valid
to validate json request with jax-rs
Is it possible to validate a field against another field?
So this is how I wanna construct the request body:
@JsonProperty
private Integer peopleCount
@JsonProperty
@Min(value = 0)
@Max( value = peopleCount)
private Integer personId;
So when I pass
{
"peopleCount":2,
"personId": 4
}
it should throw an error
but @Max( value = peopleCount)
does not work since it requires a constant value
please note that I'm trying to validate against the json request itself and not the values saved in DB
Thanks in advance