I've a RESTful web applications where all the server side validations are in place. For example, there is a request object for creating saleOrder:
public class WsSaleOrder {
@NotNull
@Length(max = 45)
private String code;
@Length(max = 45)
private String displayOrderCode;
@NotNull
@Length(max = 45)
private String customerCode;
@Length(max = 100)
private String customerName;
private String channel;
@Email
@Length(max = 100)
private String notificationEmail;
....
}
When createSaleOrder api is invoked, the request object is validated and validation errors are returned. Now I want to create a UI form for this and I would like to have all validations present on client side as well from usability perspective.
Is there a standard way by which I can dynamically pass this validation profile to the client by reading the annotations present on the request object.