|
1 | | -OpenAPI 3.0.X JSON Schema |
2 | | ---- |
| 1 | +# OpenAPI 3.0.X JSON Schema |
3 | 2 |
|
4 | | -Here you can find the JSON Schema for validating OpenAPI definitions of versions 3.0.X. |
| 3 | +This directory contains the YAML source for generating the JSON Schema for validating OpenAPI definitions of versions 3.0.X, which is published on [https://spec.openapis.org](https://spec.openapis.org). |
5 | 4 |
|
6 | | -As a reminder, the JSON Schema is not the source of truth for the Specification. In cases of conflicts between the Specification itself and the JSON Schema, the Specification wins. Also, some Specification constraints cannot be represented with the JSON Schema so it's highly recommended to employ other methods to ensure compliance. |
| 5 | +Due to limitations of GitHub pages, the schemas on the spec site are served with `Content-Type: application/octet-stream`, but should be interpreted as `application/schema+json`. |
7 | 6 |
|
8 | | -The iteration version of the JSON Schema can be found in the `id` field. For example, the value of `id: https://spec.openapis.org/oas/3.0/schema/2019-04-02` means this iteration was created on April 2nd, 2019. |
| 7 | +The source in this directory, which has `WORK-IN-PROGRESS` in its `id`, is _not intended for direct use_. |
9 | 8 |
|
10 | | -To submit improvements to the schema, modify the schema.yaml file only. |
| 9 | +## Schema `id` dates |
| 10 | + |
| 11 | +The published schemas on the spec site have an _iteration date_ in their `id`s. |
| 12 | +This allows the schemas for a release line (in this case 3.0) to be updated independent of the spec patch release cycle. |
| 13 | + |
| 14 | +The iteration version of the JSON Schema can be found in the `id` field. |
| 15 | +For example, the value of `id: https://spec.openapis.org/oas/3.0/schema/2019-04-02` means this iteration was created on April 2nd, 2019. |
| 16 | + |
| 17 | +We are [working on](https://github.com/OAI/OpenAPI-Specification/issues/4152) how to best provide programmatic access for determining the latest date for each schema. |
| 18 | + |
| 19 | +## Improving the schema |
| 20 | + |
| 21 | +As a reminder, the JSON Schema is not the source of truth for the Specification. |
| 22 | +In cases of conflicts between the Specification itself and the JSON Schema, the Specification wins. |
| 23 | +Also, some Specification constraints cannot be represented with the JSON Schema so it's highly recommended to employ other methods to ensure compliance. |
| 24 | + |
| 25 | +The schema only validates the mandatory aspects of the OAS. |
| 26 | +Validating requirements that are optional, or field usage that has undefined or ignored behavior are not within the scope of this schema. |
| 27 | +Schemas to perform additional optional validation are [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4141). |
| 28 | + |
| 29 | +Improvements can be submitted by opening a PR against the `main` branch. |
| 30 | + |
| 31 | +Modify the `schema.yaml` file and add test cases for your changes. |
11 | 32 |
|
12 | 33 | The TSC will then: |
13 | 34 | - Run tests on the updated schema |
14 | 35 | - Update the iteration version |
15 | | -- Convert the schema.yaml to schema.json |
16 | 36 | - Publish the new version |
| 37 | + |
| 38 | +The [test suite](../../tests/v3.0) is part of this package. |
| 39 | + |
| 40 | +```bash |
| 41 | +npm install |
| 42 | +npm test |
| 43 | +``` |
0 commit comments