Skip to content

why schema keyword value can not be a path? #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DaiKiQi opened this issue Dec 14, 2019 · 6 comments
Closed

why schema keyword value can not be a path? #236

DaiKiQi opened this issue Dec 14, 2019 · 6 comments

Comments

@DaiKiQi
Copy link

DaiKiQi commented Dec 14, 2019

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?

@stevehu
Copy link
Contributor

stevehu commented Dec 14, 2019

@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

@DaiKiQi
Copy link
Author

DaiKiQi commented Dec 14, 2019

I have implemented in keyword minimum maximum,can you give some review?

@stevehu
Copy link
Contributor

stevehu commented Dec 14, 2019

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.

@SridharSubramaniam
Copy link

It's being discussed here with $data and relative json pointer. Not made it to the spec yet though.

json-schema-org/json-schema-spec#51

@stevehu
Copy link
Contributor

stevehu commented Dec 20, 2019

@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.

@stevehu
Copy link
Contributor

stevehu commented Mar 20, 2020

Given this has been discussed intensively, I am closing this issue. Thank you, everyone, for the inputs.

@stevehu stevehu closed this as completed Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants