In below json request, you can see salary is available at 3 level student level, trainee level and properties level
employee{
id :"123";
name : "ABC";
salary : 100;
college : "abcd..";
Trainees : {
id :"101";
name :"XYZ";
salary :50;
}
properties :{ // key value pair values
default.salary= 20
default.college=null
}
}
As salary is mandatory for my application, so salary should be available at least one level.
If salary field and its value is not available at all level then some error should be thrown and request should not be processed by rest webservice and if salary is available at any one level then request should be accepted and processed by rest webservice.
I am using currently javax.validation.constraints for json request validation, Is there any way to achieve above requirement?