Repository navigation
Commit 62967c7
committed
Check OpenAPI 3.0 schemas against the OAS 3.0 Schema Object schema
OpenAPI 3.0 schemas were checked against the JSON Schema Draft 4
metaschema, which accepts keywords OpenAPI 3.0 does not support
(type arrays, definitions, id, $schema, patternProperties, const,
unknown keywords, ...).
Vendor the official OAS 3.0 schema (2024-10-18) unmodified and check
OAS 3.0 schemas against its Schema, Reference, Discriminator, XML and
ExternalDocumentation definitions. Schema or Reference is chosen by the
presence of $ref instead of the official oneOf, so errors point at the
offending keyword and keys next to $ref are ignored as the
specification requires.
Apply the check to OAS30Validator and the Strict, Read and Write
variants; the variants previously used jsonschema's default Draft 4
check.
This is a breaking change: schemas using unsupported keywords, and
roots carrying non-Schema Object keys such as components or a whole
OpenAPI document, now raise SchemaError. Referenced schemas can be
provided via registry, or the check skipped with check_schema=False.1 parent 867fea5 commit 62967c7
5 files changed
Lines changed: 2033 additions & 1 deletion
File tree
- docs
- openapi_schema_validator
- schemas/oas3.0/schema
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
164 | 184 | | |
165 | 185 | | |
166 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
0 commit comments