API reference rebuilt: Swagger UI out, a generated static page in the site's own design

api.html was Swagger UI with the site's colors painted over it — a foreign layout in
a black-and-green frame. It is now generated: scripts/build-api-docs.mjs reads
api/openapi.yaml and emits the whole reference as static HTML, so the page needs no
runtime rendering and no CDN bundle. One card per endpoint (method badge, path, one
line of summary) that unfolds into the description, what authentication it wants, the
parameter and body tables and the response codes; the named schemas live once in their
own section and every type links to them. The chapter rail is the site's own .side
markup — the hamburger sheet on a phone, a Contents drawer from 980px up.

The generator is deterministic and re-runnable: node scripts/build-api-docs.mjs
rewrites website/api.html, and the file says so in its first comment. js-yaml is a
build-time devDependency in the repo root; nothing new ships to the browser.

Also drops gym.duarte-santos.ch as an example server from the spec. That instance is
semi-private, and the docs have no business pointing anyone at it: the servers are now
the relative / and a neutral https://opengym.example.com ("your self-hosted instance").
This commit is contained in:
Duarte Santos committed 2026-08-31 14:08:24 +02:00
1 parent f2b3a0f028
commit 572f50cd4f
6 files changed
+2932 -119

No files matched your search

+6
View File
@@ -28,6 +28,12 @@ two things that come from the public gitlab.com API at view time — the star/is
counts and the About page's release timeline. Those two URLs pointed at
api.github.com until that account was suspended; they go back once it is restored.
`api.html` is the one **generated** file in here: `node scripts/build-api-docs.mjs`
rewrites it from `../api/openapi.yaml`. Edit the spec, re-run the script, commit both —
never hand-edit `api.html`, the next run overwrites it. The page is static HTML in this
site's own design (no Swagger UI, nothing rendered at view time); the only script of its
own it carries is the contents drawer and the card expand/collapse.
`styles.css` and `site.js` are cache-busted with `?v=N` — nginx serves the site
with `no-cache, must-revalidate`, but the query bump is what saves a Cloudflare
edge from handing out an old stylesheet with new markup. Bump it on every change.
+2219 -117
View File
File diff suppressed because it is too large. Load diff