Skip to content

feat: commit openapi-schema.yml + add freshness gate#951

Open
ChristopherChudzicki wants to merge 1 commit into
open5e:stagingfrom
ChristopherChudzicki:cc/committed-openapi-spec
Open

feat: commit openapi-schema.yml + add freshness gate#951
ChristopherChudzicki wants to merge 1 commit into
open5e:stagingfrom
ChristopherChudzicki:cc/committed-openapi-spec

Conversation

@ChristopherChudzicki

Copy link
Copy Markdown

What are the relevant tickets?

Closes #950

Description (What does it do?)

This PR implements the proposal in LINK_TO_ISSUE. The OpenAPI spec is committed, and its freshness is guarded by:

  1. A CI check (openapi-spec-freshness.yml) that genereates the spec itself and diffs with the committed version. An out-of-date spec fails the check.
  2. Adds openapi-schema.yml text eol=lf merge=binary in order to:
    • eol=lf normalizes line endings across platforms, important for the CI check;
    • merge=binary prevents textual merging. If pr-branch has modified the spec, and base branch has modified the spec, too, then there will be a conflict. pr-branch must regenerate.

How can this be tested?

I've opened a few PRs against this branch on my own fork. You can see the CI check failing/passing there:

Track the generated drf-spectacular OpenAPI spec at the repo root and
add a CI gate that regenerates on each PR head and fails if the result
doesn't match the committed file.

- .gitattributes: openapi-schema.yml text eol=lf merge=binary
  (eol=lf normalizes line endings cross-platform; merge=binary blocks
   GitHub's server-side text-merge of two concurrent spec edits)
- openapi-schema.yml: the canonical generated spec (~9k lines)
- .gitignore: stop ignoring openapi-schema.yml
- .github/workflows/openapi-spec-freshness.yml: freshness gate (uv-based)
- README.md: document the committed file + regen command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Commit the drf-spectacular generated OpenAPI spec in git

1 participant