|
| 1 | +# OpenAPI 3.1.X JSON Schema |
| 2 | + |
| 3 | +Here you can find the JSON Schema for validating OpenAPI definitions of versions |
| 4 | +3.1.X. |
| 5 | + |
| 6 | +As a reminder, the JSON Schema is not the source of truth for the Specification. |
| 7 | +In cases of conflicts between the Specification itself and the JSON Schema, the |
| 8 | +Specification wins. Also, some Specification constraints cannot be represented |
| 9 | +with the JSON Schema so it's highly recommended to employ other methods to |
| 10 | +ensure compliance. |
| 11 | + |
| 12 | +The iteration version of the JSON Schema can be found in the `$id` field. For |
| 13 | +example, the value of `$id: https://spec.openapis.org/oas/3.1/schema/2021-03-02` |
| 14 | +means this iteration was created on March 2nd, 2021. |
| 15 | + |
| 16 | +The `schema.yaml` schema doesn't validate the JSON Schemas in your OpenAPI |
| 17 | +document because 3.1 allows you to use any JSON Schema dialect you choose. We |
| 18 | +have also included `schema-base.yaml` that extends the main schema to validate |
| 19 | +that all schemas use the default OAS base vocabulary. |
| 20 | + |
| 21 | +## Contributing |
| 22 | +To submit improvements to the schema, modify the schema.yaml file only. |
| 23 | + |
| 24 | +The TSC will then: |
| 25 | +- Run tests on the updated schema |
| 26 | +- Update the iteration version |
| 27 | +- Convert the schema.yaml to schema.json |
| 28 | +- Publish the new version |
| 29 | + |
| 30 | +## Tests |
| 31 | +The test suite is included as a git submodule of https://github.com/Mermade/openapi3-examples. |
| 32 | + |
| 33 | +```bash |
| 34 | +npx mocha --recursive tests |
| 35 | +``` |
| 36 | + |
| 37 | +You can also validate a document individually. |
| 38 | + |
| 39 | +```bash |
| 40 | +scripts/validate.js path/to/document/to/validate.yaml |
| 41 | +``` |
0 commit comments