Skip to content

Commit e54843b

Browse files
committed
Merge remote-tracking branch 'upstream/v3.2-dev' into 3.2-schema-test-coverage
2 parents 7ff212b + 0da8496 commit e54843b

40 files changed

+4852
-343
lines changed

.github/workflows/check-restricted-files.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,27 @@ jobs:
1818
- name: Check changed files
1919
shell: bash
2020
run: |
21+
if [[ "${{ github.event.pull_request.head.repo.full_name }}" == "OAI/OpenAPI-Specification" ]] && \
22+
[[ "${{ github.event.pull_request.base.repo.full_name }}" == "OAI/OpenAPI-Specification" ]]; then
23+
24+
if [[ "${{ github.event.pull_request.head.ref }}" == "main" ]] && \
25+
[[ "${{ github.event.pull_request.base.ref }}" == "dev" ]]; then
26+
echo Sync from main to dev
27+
exit 0
28+
fi
29+
30+
if [[ "${{ github.event.pull_request.head.ref }}" == "dev" ]] && \
31+
[[ "${{ github.event.pull_request.base.ref }}" =~ ^v[0-9]+\.[0-9]+-dev$ ]]; then
32+
echo Sync from dev to ${{ github.event.pull_request.base.ref }}
33+
exit 0
34+
fi
35+
36+
if [[ "${{ github.event.pull_request.head.ref }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rel$ ]] && \
37+
[[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
38+
echo Release from ${{ github.event.pull_request.head.ref }} to main
39+
exit 0
40+
fi
41+
fi
42+
2143
echo This PR contains changes to files that should not be changed
2244
exit 1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: sync-dev-to-vX.Y-dev
2+
3+
# author: @ralfhandl
4+
5+
#
6+
# This workflow creates PRs to update the vX.Y-dev branch with the latest changes from dev
7+
#
8+
9+
# run this on push to dev
10+
on:
11+
push:
12+
branches:
13+
- dev
14+
15+
jobs:
16+
sync-branches:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Create pull requests
25+
id: pull_requests
26+
shell: bash
27+
run: |
28+
DEV_BRANCHES=$(git branch -r --list origin/v?.?-dev)
29+
for DEV_BRANCH in $DEV_BRANCHES; do
30+
BASE=${DEV_BRANCH:7}
31+
EXISTS=$(gh pr list --base $BASE --head $HEAD \
32+
--json number --jq '.[] | .number')
33+
if [ ! -z "$EXISTS" ]; then
34+
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
35+
continue
36+
fi
37+
38+
gh pr create --base $BASE --head $HEAD \
39+
--label "Housekeeping" \
40+
--title "$BASE: update from $HEAD" \
41+
--body "Merge \`$HEAD\` into \`$BASE\`."
42+
done
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
HEAD: dev

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ node_modules/
88
deploy/
99
deploy-preview/
1010
coverage/
11-
history
11+
_site/
1212
Gemfile.lock

CONTRIBUTING.md

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,25 @@ Reviews requesting changes should have their changes addressed regardless of how
195195
The specification versions are published to the [spec site](https://spec.openapis.org) by creating an `vX.Y.Z-rel` branch where `src/oas.md` is renamed to the appropriate `versions/X.Y.Z.md` file and then merged to `main`.
196196
This renaming on the `vX.Y.Z-rel` branch preserves the commit history for the published file on `main` when using `git log --follow` (as is the case for all older published files).
197197

198+
The steps for creating a `vX.Y.Z-rel` branch are:
199+
200+
1. Update `EDITORS.md` on `main`
201+
2. Merge `main` into `dev` and `dev` into `vX.Y-dev` via PRs
202+
- Sync PRs are automatically created by workflows `sync-main-to-dev` and `sync-dev-to-vX.Y-dev`
203+
3. Prepare spec files in `vX.Y-dev`
204+
- `npm run format-markdown`
205+
- `npm run build-src`
206+
- open `deploy-preview/oas.html` in browser and verify correct formatting
207+
- adjust and repeat until done
208+
- merge changes to `src/oas.md` back into `vX.Y-dev` via PR
209+
4. Create `vX.Y.Z-rel` from `vX.Y-dev` and adjust it
210+
- move `src/oas.md` to `versions/X.Y.Z.md`
211+
- copy `EDITORS.md` to `versions/X.Y.Z-editors.md`
212+
- delete `src/schemas`
213+
- delete `tests/schema`
214+
5. Merge `vX.Y.Z-rel` into `main` via PR
215+
- this PR should only add files `versions/X.Y.Z.md` and `versions/X.Y.Z-editors.md`
216+
198217
The HTML renderings of the specification versions are automatically generated from the `versions` directory on `main` by the [`respec` workflow](https://github.com/OAI/OpenAPI-Specification/blob/main/.github/workflows/respec.yaml), which generates a pull request for publishing the HTML renderings to the [spec site](https://spec.openapis.org).
199218

200219
### Schema Iterations
@@ -317,7 +336,7 @@ For information on the branch and release strategy for OAS 3.0.4 and 3.1.1 and e
317336
### Branch roles
318337

319338
* `main` is used to publish finished work and hold the authoritative versions of general documentation such as this document, which can be merged out to other branches as needed. The `src` tree is ***not*** present on `main`.
320-
* `dev` is the primary branch for working with the `src` tree, which is kept up-to-date with the most recent release on the most recent minor (X.Y) release line, and serves as the base for each new minor release line. Development infrastructure that is not needed on `main` is maintained here, and can be merged out to other non-`main` branches as needed.
339+
* `dev` is the primary branch for working with the `src` tree. Development infrastructure that is not needed on `main` is maintained here, and can be merged out to other non-`main` branches as needed.
321340
Changes on `main` are automatically included in a pull request to `dev` (see the (section on [branch sync](#branch-sync-automation)).
322341
* `vX.Y-dev` is the minor release line development branch for X.Y, including both the initial X.Y.0 minor version and all subsequent X.Y.Z patch versions. All PRs are made to oldest active `vX.Y-dev` branch to which the change is relevant, and then merged forward as shown in the diagram further down in this document.
323342
* `vX.Y.Z-rel` is the release branch for an X.Y.Z release (including when Z == 0). It exists primarily for `git mv`-ing `src/oas.md` to the appropriate `versions/X.Y.Z.md` location before merging back to `main`, and can also be used for any emergency post-release fixes that come up, such as when a 3rd party changes URLs in a way that breaks published links.
@@ -329,17 +348,15 @@ Upon release:
329348
* Pre-release steps:
330349
* The most recent _published_ patch release from the previous line is merged up to `vX.Y-dev`, if relevant
331350
* If doing simultaneous releases on multiple lines, do them from the oldest to newest line
332-
* If the release is the most recent on the current line, merge `vX.Y-dev` to `dev`
333351
* For example, if releasing 3.1.3 and 3.2.0:
334-
* release 3.1.3 first, including merging `v3.1-dev` to `dev` as 3.1 is current at that moment
335-
* release 3.2.0 second, also merging `v3.2-dev` to `dev` as 3.2 becomes current at that point
336-
* any subsequent 3.1.4 would **_not_** trigger a merge of `v3.1-dev` to `dev`, as 3.1 would no longer be current
352+
* release 3.1.3 first
353+
* release 3.2.0 second
337354
* Release branching and merging:
338355
* branch `vX.Y.Z-rel` from `vX.Y-dev` (same commit that was merged to `dev` if relevant)
339-
* After renaming `src/oas.md` to `versions/X.Y.Z.md`, merge `vX.Y.Z-rel` to `main`
356+
* After renaming `src/oas.md` to `versions/X.Y.Z.md` and [other adjustments](#specification-versions), merge `vX.Y.Z-rel` to `main`
340357
* Publishing to the [spec site](https://spec.openapis.org) is triggered by the merge to `main`
341358
* Post-release steps:
342-
* If this was a major or minor release (Z == 0), branch `vX.Y+1-dev` from `dev`, from the commit where `vX.Y-dev` was merged to `dev`
359+
* If this was a major or minor release (Z == 0), branch `vX.Y+1-dev` from `vX.Y-dev`
343360

344361
_Release lines are grouped by color, although the colors of `dev` and `main` are not significant as these diagrams are limited to only 8 colors._
345362

@@ -380,31 +397,50 @@ gitGraph TB:
380397
checkout v3.1-dev
381398
branch v3.1.2-rel order:3
382399
commit id:"rename src/oas.md to versions/3.1.2.md"
383-
checkout dev
384-
merge v3.1-dev id:"update dev with active line patch release"
400+
385401
checkout main
386402
merge v3.1.2-rel tag:"3.1.2"
403+
checkout dev
404+
merge main id:"auto-sync from main"
405+
checkout v3.1-dev
406+
merge dev id:"auto-sync from dev"
387407
checkout v3.2-dev
408+
merge dev id:"auto-sync from dev "
409+
388410
commit id:"more 3.2.0 work"
389411
checkout v3.1-dev
390412
commit id:"update version in src/oas.md to 3.1.3"
391413
commit id:"another 3.1.x fix"
392414
checkout v3.2-dev
393415
commit id:"still more 3.2.0 work"
394416
merge v3.1-dev id:"merge 3.1.3 fixes before releasing"
395-
checkout dev
396-
merge v3.1-dev id:"update dev with last pre-minor release patch release"
397-
merge v3.2-dev id:"update dev with minor release"
417+
398418
checkout v3.1-dev
399419
branch v3.1.3-rel order:4
400420
commit id:"rename src/oas.md to versions/3.1.3.md"
401421
checkout v3.2-dev
402422
branch v3.2.0-rel order:7
403423
commit id:"rename src/oas.md to versions/3.2.0.md"
424+
404425
checkout main
405426
merge v3.1.3-rel tag:"3.1.3"
427+
checkout dev
428+
merge main id:" auto-sync from main"
429+
checkout v3.1-dev
430+
merge dev id:" auto-sync from dev"
431+
checkout v3.2-dev
432+
merge dev id:" auto-sync from dev "
433+
434+
checkout main
406435
merge v3.2.0-rel tag:"3.2.0"
407436
checkout dev
437+
merge main id:" auto-sync from main"
438+
checkout v3.1-dev
439+
merge dev id:" auto-sync from dev"
440+
checkout v3.2-dev
441+
merge dev id:" auto-sync from dev "
442+
443+
checkout v3.2-dev
408444
branch v3.3-dev order:9
409445
checkout v3.1-dev
410446
commit id:"update version in src/oas.md to 3.1.4"
@@ -420,17 +456,36 @@ gitGraph TB:
420456
merge v3.1-dev id:"merge 3.1.4 fixes before releasing"
421457
checkout v3.3-dev
422458
merge v3.2-dev id:"merge 3.1.4 / 3.2.1 fixes"
423-
checkout dev
424-
merge v3.2-dev id:"merge patch from active release line"
459+
425460
checkout v3.1-dev
426461
branch v3.1.4-rel order:5
427462
commit id:"rename src/oas.md to versions/3.1.4.md"
428463
checkout v3.2-dev
429464
branch v3.2.1-rel order:8
430465
commit id:"rename src/oas.md to versions/3.2.1.md"
466+
431467
checkout main
432468
merge v3.1.4-rel tag:"3.1.4"
469+
checkout dev
470+
merge main id:" auto-sync from main"
471+
checkout v3.1-dev
472+
merge dev id:" auto-sync from dev"
473+
checkout v3.2-dev
474+
merge dev id:" auto-sync from dev "
475+
checkout v3.3-dev
476+
merge dev id:" auto-sync from dev "
477+
478+
checkout main
433479
merge v3.2.1-rel tag:"3.2.1"
480+
checkout dev
481+
merge main id:" auto-sync from main"
482+
checkout v3.1-dev
483+
merge dev id:" auto-sync from dev"
484+
checkout v3.2-dev
485+
merge dev id:" auto-sync from dev "
486+
checkout v3.3-dev
487+
merge dev id:" auto-sync from dev "
488+
434489
checkout v3.2-dev
435490
commit id:"update version in src/oas.md to 3.2.2"
436491
checkout v3.3-dev
@@ -442,9 +497,11 @@ gitGraph TB:
442497
To keep changes in sync, we have some GitHub actions that open pull requests to take changes from `main` onto the `dev` branch, and from `dev` to each active version branch.
443498

444499
- `sync-main-to-dev` opens a pull request with all the changes from the `main` branch that aren't yet included on `dev`.
445-
This needs a single approval from either maintainers or TSC and can be merged.
446-
The aim is to bring build script and repository documentation changes to the other branches.
447-
Published versions of the specifications and schemas will also move across branches with this approach.
500+
- `sync-dev-to-vX.Y-dev` opens pull requests with all the changes from `dev` that aren't yet included on the corresponding `vX.Y-dev` branch.
501+
502+
These need a single approval from either maintainers or TSC and can be merged.
503+
The aim is to bring build script and repository documentation changes to the other branches.
504+
Published versions of the specifications and schemas will also move across branches with this approach.
448505

449506
## Appendix: Issue Automation
450507

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ This GitHub project is the starting point for OpenAPI. Here you will find the in
1919

2020
This repository contains [the Markdown sources](versions) for [all published OpenAPI Specification versions](https://spec.openapis.org/). For release notes and release candidate versions, refer to the [releases page](releases).
2121

22-
Each folder in this repository, such as [schemas](schemas) and [tests](tests), should contain folders pertaining to the current and previous versions of the specification.
23-
2422
## See It in Action
2523

2624
If you just want to see it work, check out the [list of current examples](https://learn.openapis.org/examples/).

_archive_/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Archive
2+
3+
This folder contains files that are no longer actively maintained.

_archive_/schemas/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Archive of outdated JSON Schema Files
2+
3+
> [!TIP]
4+
> JSON Schema files for validating OpenAPI descriptions using current OpenAPI versions are available on https://spec.openapis.org/#openapi-specification-schemas.
5+
>
6+
> These schema files are maintained in the `src/schemas` folder of the corresponding `vX.Y-dev` branch in this repository.
7+
8+
> [!CAUTION]
9+
> Schema files in this folder are not maintained any more and are not intended for productive use.

_archive_/schemas/v1.2/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Swagger Specification JSON Schemas
2+
3+
The work on the JSON Schema for the Swagger Specification was donated to the community by [Francis Galiegue](https://github.com/fge)!
4+
5+
Keep in mind that due to some JSON Schema limitations, not all constraints can be described. The missing constraints will be listed here in the future.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/apiDeclaration.json#",
3+
"$schema": "http://json-schema.org/draft-04/schema#",
4+
"type": "object",
5+
"required": [ "swaggerVersion", "basePath", "apis" ],
6+
"properties": {
7+
"swaggerVersion": { "enum": [ "1.2" ] },
8+
"apiVersion": { "type": "string" },
9+
"basePath": {
10+
"type": "string",
11+
"format": "uri",
12+
"pattern": "^https?://"
13+
},
14+
"resourcePath": {
15+
"type": "string",
16+
"format": "uri",
17+
"pattern": "^/"
18+
},
19+
"apis": {
20+
"type": "array",
21+
"items": { "$ref": "#/definitions/apiObject" }
22+
},
23+
"models": {
24+
"type": "object",
25+
"additionalProperties": {
26+
"$ref": "modelsObject.json#"
27+
}
28+
},
29+
"produces": { "$ref": "#/definitions/mimeTypeArray" },
30+
"consumes": { "$ref": "#/definitions/mimeTypeArray" },
31+
"authorizations": { "$ref": "authorizationObject.json#" }
32+
},
33+
"additionalProperties": false,
34+
"definitions": {
35+
"apiObject": {
36+
"type": "object",
37+
"required": [ "path", "operations" ],
38+
"properties": {
39+
"path": {
40+
"type": "string",
41+
"format": "uri-template",
42+
"pattern": "^/"
43+
},
44+
"description": { "type": "string" },
45+
"operations": {
46+
"type": "array",
47+
"items": { "$ref": "operationObject.json#" }
48+
}
49+
},
50+
"additionalProperties": false
51+
},
52+
"mimeTypeArray": {
53+
"type": "array",
54+
"items": {
55+
"type": "string",
56+
"format": "mime-type"
57+
},
58+
"uniqueItems": true
59+
}
60+
}
61+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"id": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/authorizationObject.json#",
3+
"$schema": "http://json-schema.org/draft-04/schema#",
4+
"type": "object",
5+
"additionalProperties": {
6+
"oneOf": [
7+
{
8+
"$ref": "#/definitions/basicAuth"
9+
},
10+
{
11+
"$ref": "#/definitions/apiKey"
12+
},
13+
{
14+
"$ref": "#/definitions/oauth2"
15+
}
16+
]
17+
},
18+
"definitions": {
19+
"basicAuth": {
20+
"required": [ "type" ],
21+
"properties": {
22+
"type": { "enum": [ "basicAuth" ] }
23+
},
24+
"additionalProperties": false
25+
},
26+
"apiKey": {
27+
"required": [ "type", "passAs", "keyname" ],
28+
"properties": {
29+
"type": { "enum": [ "apiKey" ] },
30+
"passAs": { "enum": [ "header", "query" ] },
31+
"keyname": { "type": "string" }
32+
},
33+
"additionalProperties": false
34+
},
35+
"oauth2": {
36+
"type": "object",
37+
"required": [ "type", "grantTypes" ],
38+
"properties": {
39+
"type": { "enum": [ "oauth2" ] },
40+
"scopes": {
41+
"type": "array",
42+
"items": { "$ref": "#/definitions/oauth2Scope" }
43+
},
44+
"grantTypes": { "$ref": "oauth2GrantType.json#" }
45+
},
46+
"additionalProperties": false
47+
},
48+
"oauth2Scope": {
49+
"type": "object",
50+
"required": [ "scope" ],
51+
"properties": {
52+
"scope": { "type": "string" },
53+
"description": { "type": "string" }
54+
},
55+
"additionalProperties": false
56+
}
57+
}
58+
}
59+

0 commit comments

Comments
 (0)