I am using the javax.validation.constraints.NotEmpty
library to validate POJO class for rest request. Within class i have used below annotaion.
@ApiModelProperty(value = "Name", required = true)
@NotEmpty(message = "Name is required")
private String name;
Above code is working fine and returning the response as below when name is empty
"code": "NotEmpty",
"message": "Name is required"
Is there any way through which i can display/provide the my own Custom code value instead of "code": "NotEmpty"
. Something like "code": "INVALID NAME"
.
Any approach suggestion on this must be appreciated.