Skip to content

Commit fe24d3c

Browse files
authored
Merge pull request #183 from ralfhandl/main-add-v1.1
2 parents 49d917a + 0ff7a7c commit fe24d3c

29 files changed

+602
-10
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ Pull requests must come from a fork; create a fresh branch on your fork based on
3434

3535
Overview of branches:
3636

37-
- `main` holds the published versions of the specification, utility scripts and supporting documentation.
38-
- `dev` is for development infrastructure and other changes that apply to multiple versions of development.
39-
- Branches named `vX.Y-dev` are the active development branches for future releases.
40-
All changes should be applied to the _earliest_ branch where the changes are relevant in the first instance.
37+
The `main` branch holds
38+
- published versions of the specification, named `versions/X.Y.Z.md`,
39+
- work-in-progress versions of the specification, named `versions/X.Y.Z-dev.md`,
40+
- sources for published schema versions in `schemas/vX.Y` folders and their tests in `tests/vX.Y` folders,
41+
- sources for work-in-progress schema versions in `schemas/vX.Y-dev` folders and their tests in `tests/vX.Y-dev` folders,
42+
- utility scripts and supporting documentation.
43+
44+
Other branches are usually short-lived, for example and for maintaining utility scripts.
4145

4246
## Build the HTML version to publish
4347

schemas/v1.1-dev/readme.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# OpenAPI Overlay 1.1.x JSON Schema
2+
3+
Here you can find the JSON Schema for validating Overlays of versions 1.1.x.
4+
5+
As a reminder, the JSON Schema is not the source of truth for the Specification.
6+
In cases of conflicts between the Specification itself and the JSON Schema, the
7+
Specification wins. Also, some Specification constraints cannot be represented
8+
with the JSON Schema so it's highly recommended to employ other methods to
9+
ensure compliance.
10+
11+
The iteration version of the JSON Schema can be found in the `$id` field.
12+
For example, the value of `$id: https://spec.openapis.org/overlay/1.1/schema/2024-10-17` means this iteration was created on October 17, 2024.
13+
14+
## Contributing
15+
16+
To submit improvements to the schema, modify the `schema.yaml` and add test cases for your changes.
17+
18+
The TSC will then:
19+
- Run tests on the updated schema
20+
- Update the iteration version
21+
- Publish the new version
22+
23+
## Tests
24+
25+
The [test suite](../../tests/v1.1) is part of this package.
26+
27+
```bash
28+
npm install
29+
npm test
30+
```
31+
32+
You can also validate a document individually.
33+
34+
```bash
35+
node scripts/validate.mjs path/to/document/to/validate.yaml
36+
```

schemas/v1.1-dev/schema.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
$id: https://spec.openapis.org/overlay/1.1/schema/WORK-IN-PROGRESS
2+
$schema: https://json-schema.org/draft/2020-12/schema
3+
description: The description of Overlay v1.1.x documents
4+
type: object
5+
properties:
6+
overlay:
7+
type: string
8+
pattern: ^1\.1\.\d+$
9+
info:
10+
$ref: "#/$defs/info-object"
11+
extends:
12+
type: string
13+
format: uri-reference
14+
actions:
15+
type: array
16+
minItems: 1
17+
uniqueItems: true
18+
items:
19+
$ref: "#/$defs/action-object"
20+
required:
21+
- overlay
22+
- info
23+
- actions
24+
$ref: "#/$defs/specification-extensions"
25+
unevaluatedProperties: false
26+
$defs:
27+
info-object:
28+
type: object
29+
properties:
30+
title:
31+
type: string
32+
version:
33+
type: string
34+
required:
35+
- title
36+
- version
37+
$ref: "#/$defs/specification-extensions"
38+
unevaluatedProperties: false
39+
action-object:
40+
properties:
41+
target:
42+
type: string
43+
pattern: ^\$
44+
description:
45+
type: string
46+
update:
47+
type:
48+
- string
49+
- boolean
50+
- object
51+
- array
52+
- number
53+
- "null"
54+
remove:
55+
type: boolean
56+
default: false
57+
required:
58+
- target
59+
$ref: "#/$defs/specification-extensions"
60+
unevaluatedProperties: false
61+
specification-extensions:
62+
patternProperties:
63+
^x-: true

scripts/schema-publish.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
for schemaDir in schemas/v* ; do
88
vVersion=$(basename "$schemaDir")
9+
10+
if [[ "$vVersion" =~ -dev$ ]] ; then
11+
echo "Skipping dev version $vVersion"
12+
continue
13+
fi
14+
915
version=${vVersion:1}
1016
echo $version
1117

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ function runTestSuite(version, suite) {
2525
});
2626
}
2727

28-
const version = "v1.0";
29-
30-
describe(version, () => {
31-
runTestSuite(version, "pass");
32-
runTestSuite(version, "fail");
33-
});
28+
readdirSync(`./schemas`, { withFileTypes: true })
29+
.filter((dirEntry) => dirEntry.isDirectory() && /^v\d+\.\d+/.test(dirEntry.name))
30+
.forEach((dirEntry) => {
31+
const version = dirEntry.name;
32+
describe(version, () => {
33+
runTestSuite(version, "pass");
34+
runTestSuite(version, "fail");
35+
});
36+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
overlay: 1.1.0
2+
info:
3+
title: Actions invalid description
4+
version: 1.0.0
5+
actions:
6+
- target: '$' # Root of document
7+
description: 10
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
overlay: 1.1.0
2+
info:
3+
title: Invalid `target`, must begin with `$`
4+
version: 1.0.0
5+
actions:
6+
- target: info.description
7+
update: An updated description
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
overlay: 1.1.0
2+
info:
3+
title: Minimal actions
4+
version: 1.0.0
5+
actions: []
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
overlay: 1.1.0
2+
info:
3+
title: Missing actions `target`
4+
version: 1.0.0
5+
actions:
6+
- update: my description
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
overlay: 1.1.0
2+
info:
3+
title: Missing `actions`
4+
version: 1.0.0
5+
extends: '/openapi.yaml'

0 commit comments

Comments
 (0)