-
Notifications
You must be signed in to change notification settings - Fork 21
feat: add schema tests and official JSON Schema #94
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# OpenAPI Overlay 1.0.x JSON Schema | ||
|
||
Here you can find the JSON Schema for validating Overlays of versions 1.0.x. | ||
|
||
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. | ||
|
||
The iteration version of the JSON Schema can be found in the `$id` field. | ||
For example, the value of `$id: https://spec.openapis.org/overlay/1.0/schema/2024-10-17` means this iteration was created on October 17, 2024. | ||
|
||
## Contributing | ||
|
||
To submit improvements to the schema, modify the `schema.yaml` and add test cases for your changes. | ||
|
||
The TSC will then: | ||
- Run tests on the updated schema | ||
- Update the iteration version | ||
- Publish the new version | ||
|
||
## Tests | ||
|
||
The [test suite](../../tests/v1.0) is part of this package. | ||
|
||
```bash | ||
npm install | ||
npm test | ||
``` | ||
|
||
You can also validate a document individually. | ||
|
||
```bash | ||
node scripts/validate.mjs path/to/document/to/validate.yaml | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,63 @@ | ||
$id: https://spec.openapis.org/overlay/1.0/schema/WORK-IN-PROGRESS | ||
$schema: https://json-schema.org/draft/2020-12/schema | ||
description: The description of Overlay v1.0.x documents | ||
|
||
type: object | ||
properties: | ||
overlay: | ||
type: string | ||
pattern: ^1\.0\.\d+$ | ||
info: | ||
$ref: "#/$defs/info-object" | ||
extends: | ||
type: string | ||
format: uri-reference | ||
actions: | ||
type: array | ||
minItems: 1 | ||
uniqueItems: true | ||
items: | ||
$ref: "#/$defs/action-object" | ||
required: | ||
- overlay | ||
- info | ||
- actions | ||
$ref: "#/$defs/specification-extensions" | ||
unevaluatedProperties: false | ||
$defs: | ||
info-object: | ||
type: object | ||
properties: | ||
title: | ||
type: string | ||
version: | ||
type: string | ||
required: | ||
- title | ||
- version | ||
$ref: "#/$defs/specification-extensions" | ||
unevaluatedProperties: false | ||
action-object: | ||
properties: | ||
target: | ||
type: string | ||
pattern: ^\$ | ||
description: | ||
type: string | ||
update: | ||
type: | ||
- string | ||
- boolean | ||
- object | ||
- array | ||
- number | ||
- "null" | ||
remove: | ||
type: boolean | ||
default: false | ||
required: | ||
- target | ||
$ref: "#/$defs/specification-extensions" | ||
unevaluatedProperties: false | ||
specification-extensions: | ||
patternProperties: | ||
^x-: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Actions invalid description | ||
version: 1.0.0 | ||
actions: | ||
- target: '$' # Root of document | ||
description: 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Invalid `target`, must begin with `$` | ||
version: 1.0.0 | ||
actions: | ||
- target: info.description | ||
update: An updated description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Minimal actions | ||
version: 1.0.0 | ||
actions: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Missing actions `target` | ||
version: 1.0.0 | ||
actions: | ||
- update: my description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Missing `actions` | ||
version: 1.0.0 | ||
extends: '/openapi.yaml' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Actions not unique | ||
version: 1.0.0 | ||
actions: | ||
- target: '$.info.title' | ||
update: 'My New title' | ||
- target: '$.info.title' | ||
update: 'My New title' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Invalid `extends` type | ||
version: 1.0.0 | ||
extends: {} | ||
actions: | ||
- target: '$' # Root of document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
overlay: 1.0.0 | ||
info: | ||
version: 1.0.0 | ||
actions: | ||
- target: '$' # Root of document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Missing Info version | ||
actions: | ||
- target: '$' # Root of document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
overlay: 2 | ||
info: | ||
title: Invalid Overlay version | ||
version: 1.0.0 | ||
actions: | ||
- target: '$' # Root of document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ actions: | |
update: | ||
name: newParam | ||
in: query | ||
schema: | ||
type: string |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Actions Description | ||
version: 1.0.0 | ||
actions: | ||
- target: '$' # Root of document | ||
description: this is an action description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Actions Extensions | ||
version: 1.0.0 | ||
actions: | ||
- target: '$' # Root of document | ||
x-myActionsExtension: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Actions Remove and Update defined | ||
version: 1.0.0 | ||
actions: | ||
- target: $.paths.*.get.parameters | ||
update: | ||
name: newParam | ||
in: query | ||
schema: | ||
type: string | ||
remove: true |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Info Extensions | ||
version: 1.0.0 | ||
x-myInfoExtension: {} | ||
actions: | ||
- target: '$' # Root of document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
overlay: 1.0.0 | ||
info: | ||
title: Root Extensions | ||
version: 1.0.0 | ||
actions: | ||
- target: '$' # Root of document | ||
x-myExtension: {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.