You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Ajv you are you using?
4.5.0 What problem do you want to solve?
The $data reference only supports relative JSON pointers, which limits code reuse for data that is always in one location but $data referenced in multiple places. It also creates problems for more complex schemas; for example, a recursive schema can't reference data in the root of the document because it's relative distance to the root changes depending on how many levels deep you've gone. What do you think is the correct solution to problem?
Add in support for regular (absolute) JSON pointers to the $data reference. I have an issue open on the JSON-Schema Github for adding this to the v5 proposal (json-schema-org/json-schema-spec#40) that explains the issue in a bit more depth. The short version is, regular JSON pointers start with a / instead of a number, and the pointer is always anchored to the root of the document, which solves the problem. Additionally, since relative pointers ALWAYS start with a number, there's no ambiguity as to which type of pointer you're trying to use. Will you be able to implement it?
I couldn't find where the code for handling the relative pointers is located, but point me in the right direction and I might be able to. However, the $data reference looks like some of the more complicated parts of the library, so I can't say for sure.
The text was updated successfully, but these errors were encountered:
The proposals are all on the old repo and haven't been moved over, so I was a bit confused if anyone would have even noticed if I had changed it. Didn't want to ruffle too many feathers.
I'll try to have a pull request/admission of failure ready by tomorrow.
epoberezkin
changed the title
Feature Request: Add support for regular JSON Pointers to the $data reference
Add support for absolute JSON Pointers in the $data reference
Aug 28, 2016
What version of Ajv you are you using?
4.5.0
What problem do you want to solve?
The $data reference only supports relative JSON pointers, which limits code reuse for data that is always in one location but $data referenced in multiple places. It also creates problems for more complex schemas; for example, a recursive schema can't reference data in the root of the document because it's relative distance to the root changes depending on how many levels deep you've gone.
What do you think is the correct solution to problem?
Add in support for regular (absolute) JSON pointers to the $data reference. I have an issue open on the JSON-Schema Github for adding this to the v5 proposal (json-schema-org/json-schema-spec#40) that explains the issue in a bit more depth. The short version is, regular JSON pointers start with a / instead of a number, and the pointer is always anchored to the root of the document, which solves the problem. Additionally, since relative pointers ALWAYS start with a number, there's no ambiguity as to which type of pointer you're trying to use.
Will you be able to implement it?
I couldn't find where the code for handling the relative pointers is located, but point me in the right direction and I might be able to. However, the $data reference looks like some of the more complicated parts of the library, so I can't say for sure.
The text was updated successfully, but these errors were encountered: