Spring Rest API Validation
https://jcp.org/en/jsr/detail?id=303
@NotBlank(message = "username can't empty!")
String username;
@NotBlank(message = "username can't empty!")
String username;
@NotBlank
@Size(min = 3, max = 50)
private String username;
@NotEmpty
@Length(max = 140)
private String text;
| ConstraintComposition | Boolean operator that is applied to all constraints of a composing constraint annotation. |
| CreditCardNumber | The annotated element has to represent a valid credit card number. |
| CreditCardNumber.List | Defines several @CreditCardNumber annotations on the same element. |
| The string has to be a well-formed email address. | |
| Email.List | Defines several @Email annotations on the same element. |
| Length | Validate that the string is between min and max included. |
| Length.List | Defines several @Length annotations on the same element. |
| NotBlank | Validate that the annotated string is not null or empty. |
| NotBlank.List | Defines several @NotBlank annotations on the same element. |
| NotEmpty | Asserts that the annotated string, collection, map or array is not null or empty. |
| NotEmpty.List | Defines several @NotEmpty annotations on the same element. |
| Range | The annotated element has to be in the appropriate range. |
| Range.List | Defines several @Range annotations on the same element. |
| SafeHtml | Validate a rich text value provided by the user to ensure that it contains no malicious code, such as embedded |
Comments
Post a Comment