-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
For discussion only; support JSON Schema Draft 6 in 3.1 #1766
Conversation
@MikeRalphson this looks good at a glance. The One question: Why not go to draft-07? It adds several useful things and is strictly compatible with draft-06. At most you might want to check if we have any slight incompatibilities for draft-07 would also allow using |
Isn't 7 the draft which gets closer to Turing completeness? |
- `properties` - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). | ||
- `additionalProperties` - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true`. | ||
- `description` - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. | ||
- `format` - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably make sure none of the formats added in the newer draft conflict with the ones OpenAPI defines. Putting this here as a reminder to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should run a copy of our registry site and we can both cross-reference before adding anything which conflicts?
@MikeRalphson I don't know if you wanted an actual discussion of this, but I figure it might be of interest so here goes... TL;DR:
LOL. In all seriousness,
|
Models are defined using the [Schema Object](#schemaObject), which is an extended subset of JSON Schema Specification Wright Draft 00. | ||
Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 01](https://tools.ietf.org/html/draft-wright-json-schema-01#section-4.2). | ||
`null` is only supported as a type modifier (see [`nullable`](#schemaNullable) for an alternative and equivalent method of achieving nullable types). | ||
Models are defined using the [Schema Object](#schemaObject), which is a proper superset of JSON Schema Specification Wright Draft 01. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is proper meant in this case? If it's only there to differentiate from the current improper (subset/superset/sideset) situation, maybe we could drop it, or find another word which explains that a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, will peruse the thesaurus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention was this specific meaning: https://mathinsight.org/definition/proper_superset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
This is excellent. AFAIK the only reason draft 6 was not seem as an acceptable move for OpenAPI v3.1, is that folks currently validating their OpenAPI with JSON Schema Draft 4 validators will no longer be able to? That is me roughly quoting from @webron from a TSC call many months ago, so please correct me if I'm wrong Ron. That scenario was a bit odd to me, because most folks cannot use a straight up Draft 4 parser anyway, and if they are they're very very lucky that they didn't bump into nullable or any of the other discrepancies. #1736 will be great, and give folks not just a way to use JSON Schema proper (any draft that the tooling supports) along with other schema systems entirely (any that the tooling supports) but this would be a strong win right off the bat without pushing such a large set of variables onto the tooling vendors. Most validators out there worth their salt support Draft 6, and Draft 6 is a lot better than Draft 4, and the ability to wipe out these discrepancies will stop folks needing to worry about using workarounds like https://github.com/wework/json-schema-to-openapi-schema and Speccy's Resolve Command, etc. If OpenAPI folks want to jump up to draft 7 that'd be great too, but if draft 6 is used and we can shrink the discrepancies list like this PR does, I certainly won't be sad. |
Closing in favour of #1977 - thanks all. |
I think this is all that would need to be done to get us off "the draft that never was". Draft 6 being expired should not be a problem as Draft 5 is expired, so is Draft 7 and Draft 8 isn't out yet. I think it can be done in a semver-minor compatible way.