Forum Discussion

rascaly2k's avatar
rascaly2k
Occasional Visitor
3 years ago

how to create a json schema based on derived fields and value is in between a range

Hi I am a noob to the swagger world and would appreciate any suggestion or guidance on how to create a schema to validate

{

 state:"AZ"

 county:1

}

 

In the above request the value of county is driven by the state field and the values are static range bound values

For example :

If I entered  state:AZ and county :1 from the api

 I need to makes sure the value of county is in between the values of 1-3

If I entered  state:AZ and county :5 from the api

 I throw an error mentioning not valid value, please enter value between 1 and 3

If I entered  state:PA and county :2 from the api

 I need to makes sure the value of county is in between the values of 4-6

 

Any help and guidance would be appreciated

Thanks

Jason

No RepliesBe the first to reply