Skip to content

Commit the generated OpenAPI spec and check it for drift - #837

Merged
s3rot0n1n merged 1 commit into
platform-based-rewritefrom
api/commit-openapi-spec
Oct 30, 2026
Merged

s3rot0n1n merged 1 commit into
platform-based-rewritefrom
api/commit-openapi-spec

Conversation

@s3rot0n1n

Copy link
Copy Markdown
Contributor

Summary

The rewrite builds its OpenAPI spec at runtime from the ts-rest contract and serves it at /openapi.json, but no copy is committed. The old app committed apps/web/openapi/generated/openapi.json; it was removed with the platform migration (6587b560). Tools that read the spec from the repository, such as the API reference in the docs, have nothing to point at.

  • bun run generate:openapi (in apps/api) writes createOpenApiDocument("https://api.courselit.app") to apps/api/openapi.json. It's pretty-printed so diffs are reviewable.
  • check:openapi joins check:drift, which the Platform conformance workflow already runs, so CI fails when a contract change isn't followed by a regenerated spec. The error says which command to run.
  • Biome skips apps/api/openapi.json (2.4 MB; Biome already skipped it for size, with a warning).
  • docs/platform-based-rewrite.md mentions the committed copy.

The script follows generate-auth-schema.mjs: the same write-or---check shape and drift message.

The spec: OpenAPI 3.0.2, 213 operations, 13 tags. The default server is https://api.courselit.app, with the existing {protocol}://{host} variables.

Testing

  • bun run check:drift passes. A second generate:openapi run leaves the file unchanged.
  • bun test src/openapi.test.ts passes.

🤖 Generated with Claude Code

- `bun run generate:openapi` writes the spec the API serves at /openapi.json
  to apps/api/openapi.json, with the production API host as the default
  server.
- `check:openapi` joins `check:drift`, so CI fails when the committed spec
  no longer matches the contract.
- Tools that read the spec from the repository (the docs' API reference)
  can point at apps/api/openapi.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T07:27:48.636377Z 4899d0a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@s3rot0n1n

Copy link
Copy Markdown
Contributor Author

CI note: verify fails at platform-cli doctor with external_mismatch:next before reaching check:drift. The same doctor run fails on the base commit (b8e4292d) locally, so it's already present on platform-based-rewrite and unrelated to this change; this is the workflow's first run on a PR into this branch. bun run check:drift (including the new check:openapi) passes locally.

@s3rot0n1n
s3rot0n1n merged commit f4aaa40 into platform-based-rewrite Oct 30, 2026
2 of 3 checks passed
@s3rot0n1n
s3rot0n1n deleted the api/commit-openapi-spec branch October 30, 2026 17:25
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.

1 participant