Share Redoc API docs
An OpenAPI spec is reviewed twice: once as YAML, badly, and once as rendered documentation, months later, when a consumer discovers the description was wrong.
The second review is the one that catches things. It just usually happens after the docs are published, because rendering the spec for a reviewer means running a server and telling them where.
Redocly's CLI removes half of that — one command, one HTML file.
Publish it
npx @redocly/cli build-docs openapi.yaml -o redoc.html
curl -X POST https://commareports.com/api/v1/reports \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html redoc.html \
--arg title "API docs — $BRANCH" \
'{title: $title, html: $html}')"
Or drag redoc.html into the app.
Navigation, search and schema expansion keep working at the link —
scripts run inside a sandboxed iframe (allow-scripts, no
allow-same-origin).
For a per-PR preview, PATCH a report id stored in your branch's CI
variables, so the same URL shows the current build and every earlier one.
See GitHub Actions.