This is class against which we are going to map the incoming request
@Getter
@Setter
public class FooRequest {
@Size(max = 255, message = "{error.foo.name.size}")
private String name;
@Digits(integer = 15, fraction = 0, message = "{error.foo.fooId.size}")
private Long fooId;
@Digits(integer = 15, fraction = 0, message = "{error.foo.barId.size}")
private Long barId;
}
I have used javax.validation.constraints.*
like above. If we send request like
{
"name": "Test",
"fooId": "0001234567",
"barId": "0003456789"
}
Then It works fine and we are able to save the results in the database but if we send it like:
{
"name": "Test",
"fooId": 0001234567,
"barId": 0003456789
}
Then we are getting 400 Bad Request
. I am not getting it what wrong am I doing, I just want to ensure that user sends digits, having length between 1-15 and wants to map it against the Long
variable. Is it because of fraction
or because all these values are starting with 0?