Skip to content

Commit fc9a0e1

Browse files
author
Anonymous Committer
committed
Clarify OpenAPI spec and baseline update workflow
1 parent 0b5da2f commit fc9a0e1

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,35 @@ This repository only owns the Python SDK. The canonical OpenAPI document plus th
9494
- If `openapi/justserpapi.openapi.json` is committed, local generation is fully reproducible.
9595
- If it is not committed, CI can fetch and cache it by running `python scripts/sdkctl.py fetch-spec` with `JUSTSERPAPI_API_KEY` configured.
9696

97-
Typical maintenance flow:
97+
If the API changes, update these files:
98+
99+
- `openapi/justserpapi.openapi.json`: the current canonical spec used to validate and generate the SDK
100+
- `openapi/baseline/justserpapi.openapi.json`: the previous released spec snapshot used only for breaking-change checks
101+
102+
Typical maintenance flow after an API change:
98103

99104
```bash
105+
cp /path/to/latest-openapi.json openapi/justserpapi.openapi.json
100106
python scripts/sdkctl.py validate-examples
101-
python scripts/sdkctl.py validate-spec --skip-generator-validate
107+
python scripts/sdkctl.py validate-spec
108+
python scripts/sdkctl.py breaking-check
102109
python scripts/sdkctl.py generate --clean
103110
```
104111

112+
If this new spec is the one you are about to release, update the baseline after validation:
113+
114+
```bash
115+
cp openapi/justserpapi.openapi.json openapi/baseline/justserpapi.openapi.json
116+
```
117+
105118
## Release
106119

107120
Official releases are tag-driven:
108121

109122
```bash
123+
python scripts/sdkctl.py validate-examples
124+
python scripts/sdkctl.py verify-release --tag vX.Y.Z
125+
python -m build
110126
python scripts/sdkctl.py verify-release --tag vX.Y.Z
111127
git push origin vX.Y.Z
112128
```

openapi/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
# Canonical OpenAPI Document
22

3-
This directory is the source of truth for every SDK repository.
3+
This directory is the source of truth for the Python SDK.
44

55
Expected files:
66

7-
- `openapi/justserpapi.openapi.json`: the canonical OpenAPI document that drives Python, Java, and Go generation.
8-
- `openapi/baseline/justserpapi.openapi.json`: the last released spec snapshot used for breaking-change checks.
7+
- `openapi/justserpapi.openapi.json`: the canonical OpenAPI document that drives Python SDK validation and generation.
8+
- `openapi/baseline/justserpapi.openapi.json`: the previous released spec snapshot used for breaking-change checks.
99

1010
If the canonical spec is not committed, CI is expected to fetch it with `python scripts/sdkctl.py fetch-spec` and cache it as a workflow artifact.
1111

12-
Bootstrap flow:
12+
When the API changes:
1313

1414
1. Export or fetch the latest OpenAPI document into `openapi/justserpapi.openapi.json`.
1515
2. Run `python scripts/sdkctl.py validate-examples`.
1616
3. Run `python scripts/sdkctl.py validate-spec`.
17-
4. Run `python scripts/sdkctl.py generate --clean`.
18-
5. Run `python scripts/sdkctl.py sync-repos --push --tag` once the generated outputs look correct.
17+
4. Run `python scripts/sdkctl.py breaking-check` if `openapi/baseline/justserpapi.openapi.json` exists.
18+
5. Run `python scripts/sdkctl.py generate --clean`.
19+
6. If the spec is the next release candidate, copy it to `openapi/baseline/justserpapi.openapi.json` after validation.
1920

2021
If the API spec is protected, fetch it with:
2122

2223
```bash
2324
JUSTSERPAPI_API_KEY=... python scripts/sdkctl.py fetch-spec
2425
```
2526

26-
The repo currently ships test fixtures under `tests/fixtures/` so CI can exercise the orchestration code even when the canonical spec must be fetched at workflow time.
27+
Release reminder:
28+
29+
- `openapi/justserpapi.openapi.json` should describe the next release
30+
- `openapi/baseline/justserpapi.openapi.json` should describe the last published release
31+
- if `info.version` changes, keep `justserpapi/_version.py` in sync before tagging
32+
33+
The repo ships test fixtures under `tests/fixtures/` so CI can exercise the tooling even when the canonical spec must be fetched at workflow time.

openapi/baseline/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ Store the previously released canonical OpenAPI document here.
44

55
Recommended convention:
66

7-
- `openapi/justserpapi.openapi.json` is the next candidate spec.
8-
- `openapi/baseline/justserpapi.openapi.json` is the last published spec.
7+
- `openapi/justserpapi.openapi.json` is the next candidate spec you are validating now.
8+
- `openapi/baseline/justserpapi.openapi.json` is the last published spec already in production.
99

1010
`python scripts/sdkctl.py breaking-check` compares these two files and fails on obvious breaking changes such as removed operations, renamed `operationId` values, and newly required parameters.
11+
12+
Update the baseline only after you have decided the current spec is the one you will release:
13+
14+
```bash
15+
cp openapi/justserpapi.openapi.json openapi/baseline/justserpapi.openapi.json
16+
```

0 commit comments

Comments
 (0)