I have a JSON schema with 2 properties, minimumTolerance and maximumTolerance. I need to make sure that the value of maximumTolerance is not smaller than minimumTolerance &a
As of Draft-7 of the specification there is no way to do this with JSON Schema.
If you are using AJV You can do this using $data
and relative JSON pointers. Example:
low: {
type: 'integer',
maximum: {
$data: '1/high',
},
exclusiveMaximum: true,
},
high: {
type: 'integer',
minimum: {
$data: '1/low',
},
exclusiveMinimum: true,
},
Yes, but it may not be the dynamic answer you are looking for...put in the values of min and max for the range expected:
"MinimumTolerance": {
"type": "number",
"minimum": 0,
"maximum": 6000,
},
"MaximumTolerance": {
"type": "number",
"minimum": 6001,
},