Skip to content
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

Implement Draft 2019-09 #44

Open
4 of 11 tasks
Stranger6667 opened this issue May 14, 2020 · 8 comments
Open
4 of 11 tasks

Implement Draft 2019-09 #44

Stranger6667 opened this issue May 14, 2020 · 8 comments

Comments

@Stranger6667
Copy link
Owner

Stranger6667 commented May 14, 2020

Validation docs: https://tools.ietf.org/html/draft-handrews-json-schema-validation-02

New keywords:

Implementation examples - TypeScript, Python (partial)

@aexvir
Copy link

aexvir commented Aug 28, 2020

Looking forward to have this available 🙂️

@Stranger6667
Copy link
Owner Author

Hope to get back to this feature soon :)

@fimbault
Copy link

Now there's Draft 2020-12

@alexjg
Copy link
Contributor

alexjg commented Jul 26, 2021

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 $vocabulary keyword to determine which keywords are
    available to a schema
  • Implement $anchor keyword
  • Disallow use of fragments in $id (that usecase being taken up by $anchor)
  • Implement $definitions keyword
  • Implement $recursiveRef and $recursiveAnchor (these are renamed to
    $dynamicRef and $dynamicAnchor in 2020-12 but the latter is a superset of
    the former so we can use the same implementation)

Applicator Vocabulary

  • Split dependencies into dependentSchemas and dependentRequired
  • Implement unevaluatedItems and unevaluatedProperties

Format changes

  • Add an option to turn off processing of the format keyword and instead
    merely make it available as an annotation
  • Implement the duration and uuid format validators
  • Make contentEncoding available as an annotation and not as an assertion
  • Implement the contentSchema keyword

Validation

  • Implement maxContains and minContains

Meta-data

  • Implement deprecated

Based on changes from 2019-09 to 2020-12

  • replace items and additionalItems with prefixItems and ites
  • implement $dynamicRef and $dynamicAnchor (see above re. $recursive* versions)

Common components

  • Ensure that items which pass a contains schema are not processed by an
    unevaluatedItems schema. This is not specified in 2019-09 but is compatible

@Stranger6667
Copy link
Owner Author

Great write-up, @alexjg !

I have some small bits here and there (maybe incomplete):

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?

@alexjg
Copy link
Contributor

alexjg commented Jul 27, 2021

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.

@Stranger6667
Copy link
Owner Author

Great!

Here are separate issues for the entries above.

2019-09

Annotations, errors and outputs

Core vocabulary changes

Format changes

I added new keyword implementation as sub-tasks in existing issues for their relevant drafts (this one and #195 ).

@Stranger6667
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants