Skip to content

Commit 8e23d02

Browse files
committed
Update the schema READMEs for current practice
1 parent 492b9cc commit 8e23d02

File tree

2 files changed

+48
-39
lines changed

2 files changed

+48
-39
lines changed

schemas/v3.0/README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
OpenAPI 3.0.X JSON Schema
22
---
33

4-
Here you can find the JSON Schema for validating OpenAPI definitions of versions 3.0.X.
4+
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).
55

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.
6+
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+
8+
The source in this directory, which has `WORK-IN-PROGRESS` in its `id`, is _not intended for direct use_.
9+
10+
## Schema `id` dates
11+
12+
The published schemas on the spec site have an _iteration date_ in their `id`s.
13+
This allows the schemas for a release line (in this case 3.0) to be updated independent of the spec patch release cycle.
714

815
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.
916

10-
To submit improvements to the schema, modify the schema.yaml file only.
17+
The special URL with `latest` in place of the date is intended to provide an HTTP redirect to the most recent dated schema.
18+
19+
## Improving the schema
20+
21+
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.
22+
23+
The schema only validates the mandatory aspects of the OAS.
24+
Validating requirements that are optional, or field usage that has undefined or ignored behavior are not within the scope of this schema.
25+
Schemas to perform additional optional validation are [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4141).
1126

12-
The TSC will then:
13-
- Run tests on the updated schema
14-
- Update the iteration version
15-
- Convert the schema.yaml to schema.json
16-
- Publish the new version
27+
Improvements can be submitted by opening a PR against the `main` branch.

schemas/v3.1/README.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
1-
# OpenAPI 3.1.X JSON Schema
1+
OpenAPI 3.1.X JSON Schema
2+
---
23

3-
Here you can find the JSON Schema for validating OpenAPI definitions of versions
4-
3.1.X.
4+
This directory contains the YAML sources for generating the JSON Schemas for validating OpenAPI definitions of versions 3.1.X, which are published on [https://spec.openapis.org](https://spec.openapis.org).
55

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.
6+
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`.
117

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.
8+
The sources in this directory, which have `WORK-IN-PROGRESS` in their `$id`s, is _not intended for direct use_.
159

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.
10+
## Choosing which schema to use
2011

21-
## Contributing
22-
To submit improvements to the schema, modify the schema.yaml file only.
12+
There are two schemas to choose from for 3.1 usage, both of which have an `$id` that starts with `https://spec.openapis.org/oas/3.1/` and end with date or the `WORK-IN-PROGRESS` placeholder:
2313

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
14+
* `https://spec.openapis.org/oas/3.1/schema/{date}` — A self-contained schema that _does not_ validate Schema Objects beyond `type: [object, boolean]`
15+
* `https://spec.openapis.org/oas/3.1/meta/base/{date}` — The vocabulary metaschema for OAS 3.1's extensions to draft 2020-12
16+
* `https://spec.openapis.org/oas/3.1/dialect/base/{date}` — The dialect metaschema that extends the standard `draft/2020-12` metaschema by adding the OAS "base" vocabulary
17+
* `https://spec.openapis.org/oas/3.1/schema-base/{date}` — A schema that combines the self-contained schema and the "base" dialect schema to validate Schema Objects with the dialect; this schema does not allow changing `$schema` or `jsonSchemaDialect` to other dialects
2918

30-
## Tests
31-
The test suite is included as a git submodule of https://github.com/Mermade/openapi3-examples.
19+
The name "base" for the dialect was intended to indicate that the OAS dialect could be further extended.
3220

33-
```bash
34-
npx mocha --recursive tests
35-
```
21+
An additional schema that validates the Schema Object with the OAS 3.1 dialect but does not restrict changing `$schema` is [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4147).
3622

37-
You can also validate a document individually.
23+
## Schema `$id` dates
3824

39-
```bash
40-
scripts/validate.js path/to/document/to/validate.yaml
41-
```
25+
The published schemas on the spec site have an _iteration date_ in their `id`s.
26+
This allows the schemas for a release line (in this case 3.0) to be updated independent of the spec patch release cycle.
27+
28+
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.1/schema/2021-03-02`
29+
The special URL with `latest` in place of the date is intended to provide an HTTP redirect to the most recent dated schema.
30+
31+
## Improving the schemas
32+
33+
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.
34+
35+
The schema only validates the mandatory aspects of the OAS.
36+
Validating requirements that are optional, or field usage that has undefined or ignored behavior are not within the scope of this schema.
37+
Schemas to perform additional optional validation are [under consideration](https://github.com/OAI/OpenAPI-Specification/issues/4141).
38+
39+
Improvements can be submitted by opening a PR against the `main` branch.

0 commit comments

Comments
 (0)