why schema keyword value can not be a path?
I have recently used json schema to help validate json data. but i found that its hard to validate cascade relation. for example:
"ageRange": {
"minAge": 20,
"maxAge": 30
}
I want to limit 18<minAge<maxAge<50. its hard to limit minAge<maxAge. Because keyword minimum's value must be number. why schema keyword value can not be a path?like this:
"maxAge": {
"minimum": "$.ageRange.minAge",
"exclusiveMaximum": 50
}
do you have any idea to implement this?
@DaiKiQi I think your case is a good one; however, the JSON schema specification doesn't support it yet. Would you be able to open the same issue to ask if they can adjust the specification?
https://github.com/json-schema-org/json-schema-spec
I have implemented in keyword minimum maximum,can you give some review?
Yes. Please submit a PR. Meanwhile, we'd better open an issue in the json-schema-spec so that it can be a standard. Thanks.
It's being discussed here with $data and relative json pointer. Not made it to the spec yet though.
https://github.com/json-schema-org/json-schema-spec/issues/51
@SridharSubramaniam Thanks a lot for the spec link. It is quite a read :) I think it is not hard to implement it and I am looking forward to merging it into the spec. @DaiKiQi If we are doing something, the above discussion might guide us in the right direction.
Given this has been discussed intensively, I am closing this issue. Thank you, everyone, for the inputs.