Implement Draft 2019-09
Validation docs: https://tools.ietf.org/html/draft-handrews-json-schema-validation-02
New keywords:
- [x]
$anchor - [x]
$definitions - [x]
$recursiveRef - [x]
$recursiveAnchor - [ ] #287
- [x] #288
- [x]
contentSchema - [x]
maxContains - [x]
minContains - [x]
deprecated - [x] #286 (instead of
dependencies)
Implementation examples - TypeScript, Python (partial)
Looking forward to have this available 🙂️
Hope to get back to this feature soon :)
Now there's Draft 2020-12
We should be able to implement both 2019-09 and 2020-12 in one go I think. Here's my understanding of the work to be done:
Work to be done
Based on the changes from Draft-07 to 2019-09
Annotations, errors and outputs
- Implement collection of annotations whilst evaluating schemas
- Implement the "basic" output format to provide access to collected annotations
Core vocabulary changes
- Split the various keywords into different vocabularies and implement
processing of the
$vocabularykeyword to determine which keywords are available to a schema - Implement
$anchorkeyword - Disallow use of fragments in
$id(that usecase being taken up by$anchor) - Implement
$definitionskeyword - Implement
$recursiveRefand$recursiveAnchor(these are renamed to$dynamicRefand$dynamicAnchorin 2020-12 but the latter is a superset of the former so we can use the same implementation)
Applicator Vocabulary
- Split
dependenciesintodependentSchemasanddependentRequired - Implement
unevaluatedItemsandunevaluatedProperties
Format changes
- Add an option to turn off processing of the
formatkeyword and instead merely make it available as an annotation - Implement the
durationanduuidformat validators - Make
contentEncodingavailable as an annotation and not as an assertion - Implement the
contentSchemakeyword
Validation
- Implement
maxContainsandminContains
Meta-data
- Implement
deprecated
Based on changes from 2019-09 to 2020-12
- replace
itemsandadditionalItemswithprefixItemsandites - implement
$dynamicRefand$dynamicAnchor(see above re.$recursive*versions)
Common components
- Ensure that items which pass a
containsschema are not processed by anunevaluatedItemsschema. This is not specified in 2019-09 but is compatible
Great write-up, @alexjg !
I have some small bits here and there (maybe incomplete):
minContains&maxContains- https://github.com/Stranger6667/jsonschema-rs/commit/16b75185905faf5a5b15f0e76aaf9967838c3a76depentRequired- https://github.com/Stranger6667/jsonschema-rs/commit/94105822894cd296783f8f7e4b28ec2a9a56576f
Here is also some existing (but not yet merged) implementation for needed keywords. It might help to implement those keywords here.
I like the plan and would be happy to split it into granular tasks! I'll also check it in more detail in a few days.
I think some changes could be done and merged, but we may not expose them (e.g. new keyword impls) until their respective drafts are ready. So, there should be no problem with accumulating changes step-by-step. Though, we can still test them high-level via some cfg(test) items - e.g. conditional Draft201909 enum variant.
What do you think if we approach the implementation this way?
That seems like a sensible way to proceed. I'm going to make a start on the annotation collection and output formatting part as that feels like it's the largest change architecturally.
Great!
Here are separate issues for the entries above.
2019-09
Annotations, errors and outputs
- https://github.com/Stranger6667/jsonschema-rs/issues/262
- https://github.com/Stranger6667/jsonschema-rs/issues/100
- https://github.com/Stranger6667/jsonschema-rs/issues/267
Core vocabulary changes
- https://github.com/Stranger6667/jsonschema-rs/issues/263
- https://github.com/Stranger6667/jsonschema-rs/issues/264
Format changes
- https://github.com/Stranger6667/jsonschema-rs/issues/261
- https://github.com/Stranger6667/jsonschema-rs/issues/265
- https://github.com/Stranger6667/jsonschema-rs/issues/266
I added new keyword implementation as sub-tasks in existing issues for their relevant drafts (this one and #195 ).
I'll set up conditional compilation for testing & merge existing keywords implementation, so we can run tests & add new one easier. It should be pretty much isolated, so I hope we can avoid conflicting changes.