Skip to content

Add auto-generated REST API reference docs#257

Draft
nikosbosse wants to merge 1 commit intomainfrom
feat/auto-generated-rest-api-docs
Draft

Add auto-generated REST API reference docs#257
nikosbosse wants to merge 1 commit intomainfrom
feat/auto-generated-rest-api-docs

Conversation

@nikosbosse
Copy link
Contributor

Summary

  • Adds a /docs/rest-api page powered by Scalar that renders the live OpenAPI spec from the engine as interactive API reference documentation
  • The spec is fetched at build time from everyrow.io/api/v0/openapi.json via a new pre-build script (fetch-openapi.py), with fallback to a cached copy if the fetch fails
  • The CI workflow rebuilds daily at 6am UTC (cron trigger) so the docs stay in sync with API changes without any cross-repo wiring

New files

File Purpose
docs-site/scripts/fetch-openapi.py Pre-build script: fetches live OpenAPI spec → public/openapi.json (gitignored)
docs-site/src/app/rest-api/page.tsx Client component rendering the Scalar API reference viewer
docs-site/src/app/rest-api/layout.tsx Server layout providing metadata (title, OG tags, canonical URL)

Modified files

File Change
docs-site/package.json Added @scalar/api-reference-react, added prebuild script
docs-site/.gitignore Added public/openapi.json
docs-site/src/utils/docs.ts Added "REST API" link to sidebar nav
docs-site/src/app/sitemap.ts Added /docs/rest-api to sitemap
.github/workflows/deploy-docs.yaml Added daily cron + explicit fetch step + schedule deploys

Future upgrade path

Currently using Tier 1 automation (daily cron). If the lag between engine deploys and docs updates becomes a problem, can upgrade to Tier 2 (cross-repo repository_dispatch via fine-grained PAT) with minimal changes.

Test plan

  • pnpm build passes (47 static pages including /rest-api)
  • Link checker passes
  • Sitemap includes new page
  • Static HTML output serves with HTTP 200
  • Visual verification: open /docs/rest-api in browser after deploy
  • Verify daily cron triggers a successful build

🤖 Generated with Claude Code

Adds a `/docs/rest-api` page powered by Scalar that renders the live
OpenAPI spec from the engine. The spec is fetched at build time via a
pre-build script and the docs rebuild daily (6am UTC cron) to stay in
sync with API changes.

Changes:
- New `fetch-openapi.py` pre-build script (fetches from production,
  falls back to cached copy on failure)
- Scalar API Reference React component at `/docs/rest-api`
- "REST API" link added to the API Reference sidebar section
- Sitemap updated with the new page
- CI workflow gets daily cron trigger + explicit fetch step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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