I am creating a Play application with Play 2.3 in Java.
I'm trying to use Form for handling POST request with JSON body.
My problem is that if my JSON is a simple object with only Strings or Floats attribute, it works well. But if I put some of Object imbrication, it continue to bind the request corectly but don't do the Constraints validation in nested objects.
Here an exemple of what I'm trying to do :
public class PairRequest
{
@Required
public String epc;
@Required
public RequestProduct product;
}
public class RequestProduct
{
//Product data
@Constraints.Required
private String productCode;
@Constraints.Required
public Brand brand;
@Constraints.Required
private String furniture;
}
@Entity
public class Brand extends Model {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long id;
@Column(length = 250)
@Constraints.Required
public String name;
@Column(nullable = true, length = 512)
public String regex;
}
Have I missed something ? It's weird because I think it was working during first times... But I can't be sure.