-
Notifications
You must be signed in to change notification settings - Fork 156
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
fix(typings): update OpenAPI 3.0 and 3.1 typing declarations #1795
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b5361c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
0ba50f7
to
7463f90
Compare
ok, i think i'm done with this. missed a few keywords for Oas3_1 schemas. ready for review. thanks |
331b109
to
498f6b7
Compare
I added a few extra JSON Schema 2020-12 keywords that were missed |
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.
Let's make it reuse the common props slightly more.
Otherwise looks good!
498f6b7
to
99dbb67
Compare
i'm stuck on the visitors.ts and custom rule files. Any help appreciated. i will run prettier after the fixes |
c03175a
to
5428993
Compare
6221408
to
fc06632
Compare
Added missing keywords for OAS 3.1.x (JSON Schema 2020-12). Co-authored-by: Andrew Tatomyr <[email protected]>
fc06632
to
ac145cf
Compare
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.
Added a couple of suggestions. Otherwise all good.
841012c
to
b823fe8
Compare
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.
Added a couple of suggestions. Otherwise all good.
thanks for your review. updated!
8f8339b
to
204fed3
Compare
204fed3
to
b5361c3
Compare
fixes #1547
What/Why/How?
The typings for OAS 3 and OAS 3_1 schemas were incorrectly defined per the OpenAPI Specification.
OAS 3.0 has a specific requirement which defines an OpenAPI Schema rather than a JSON Schema schema. There are subtleties to the OpenAPI 3.0 Schema.
OpenAPI 3.1 Schemas are equivalent to a JSON Schema 2020-12 schema.
Reference
Per the OpenAPI 3.0 Specification
4.7.24.1 JSON Schema Keywords
The following keywords are taken directly from the JSON Schema definition and follow the same specifications:
The following keywords are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.
Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.
Additional keywords defined by the JSON Schema specification that are not mentioned here are strictly unsupported.
Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:
4.7.24.2 Fixed Fields
Per the OpenAPI 3.1 Specification
4.8.24 Schema Object
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 2020-12. The empty schema (which allows any instance to validate) MAY be represented by the boolean value true and a schema which allows no instance to validate MAY be represented by the boolean value false.
For more information about the keywords, see JSON Schema Core and JSON Schema Validation.
Unless stated otherwise, the keyword definitions follow those of JSON Schema and do not add any additional semantics; this includes keywords such as $schema, $id, $ref, and $dynamicRef being URIs rather than URLs. Where JSON Schema indicates that behavior is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application consuming the OpenAPI document.
Testing
Screenshots (optional)
Check yourself
Security