Exclusively Constraining Number
We have added a new property salary to the JSON object. In this lesson we will define ranges for the age and salary properties.
1{ 2 "name": "John Doe", 3 "age": 25, 4 "salary": 50000 5}
Schema Definition
To apply exclusive constraints on number values, you can use the following keywords:
- x > exclusiveMinimum
- x < exclusiveMaximum
now try to add the age and salary properties in the schema given on the side editor with the constraints mentioned below using exclusiveMinimum and exclusiveMaximum keywords:
- age should be greater than 18 and less than 60
- salary should be greater than 30000 and less than 80000
Loading...
Output
Please click the button or use
Shift+Enter
to view the output