I am trying to apply validation for telephone number, we can allow it to be null and empty. But it has to be the size of 10 characters only whenever entered.
this is the code I have
@Size(max=10,min=10, message = "mobile no. should be of 10 digits")
private String mobile;
when I pass no value at all, the null is accepted, but when I pass an empty string like this.
"mobile":""
It gives me error that "mobile no. should be of 10 digits".