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

Add Draft-06 and Draft-07 support #178

Closed
7 of 8 tasks
johandorland opened this issue Jan 24, 2018 · 3 comments
Closed
7 of 8 tasks

Add Draft-06 and Draft-07 support #178

johandorland opened this issue Jan 24, 2018 · 3 comments

Comments

@johandorland
Copy link
Collaborator

johandorland commented Jan 24, 2018

I've been looking at adding support for draft-06 and draft-07 recently. This should be very doable, but it seemed like at least a good idea to make a todo public list and maybe have a public discussion about some implementation details. Draft-06 introduces some backwards incompatible changes, most notably changes to exclusiveMinimum, exclusiveMaximum, id vs $id and the possibility to have a property named $ref.

  • The current test setup is a bit of a PITA to maintain (especially now with different draft versions), so it's probably best to ditch the current test suite and create one that directly uses the test files as defined in the official test suite without manual transformation like now. The current setup has the advantage however that errors are checked more thoroughly than just being valid or invalid however.
  • Add support for handling different versions of JSON Schema. Detection of the version could be done based on the $schema keyword. Default to draft-04 for backwards compatibility.
  • Add some new interfaces to different loaders so a specific draft be enforced upon schema loading time instead of relying on the $schema keyword. This would probably be needed for testing, but some developers might also want to manually enforce it.
  • Add support for propertyNames, contains and const
  • Change some behaviour related to edge cases (requires, dependencies and using booleans as schemas) I'd not be surprised if gojsonschema already handles some of these correctly by accident.
  • A lot of new metadata fields are added like examples, $comment, readOnly, writeOnly, contentMediaType, contentMediaEncoding, etc. The current metadata fields like title and description are parsed, but nothing is done with the data. If we implement Feature Request: Validate input schema against metaschema #174, there is really no need to even look at these type of fields explicitly since they are not used for validation.
  • Add a bunch off new format checkers. Both draft-06 and draft-07 defined a lot of them. It happens that regex, date and time were already part of draft-03 and also implemented here.
  • If-then-else is the biggest part of draft-07, but a pull request is already pending Add support for if/then/else #177

For anyone interested here are the release notes for draft-06 and draft-07

@handrews
Copy link

Note that the added emphasis on meta-data is likely to continue (but not necessarily all in the validation spec). json-schema-org/json-schema-spec#530 tracks formalizing how that should work and will likely result in more formal guidance on annotations / metadata collection in draft-08. You might want to keep that in mind while adding support now.

@ajackson-cpi
Copy link

Your top-level repo title says it only supports draft-04

@johandorland
Copy link
Collaborator Author

Your top-level repo title says it only supports draft-04

I only have commit rights, so I can't edit the description. @xeipuuv, could you change the description for the repo to include draft v6 and dravt v7 support?

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