Publish the API reference to GitHub Pages - #220
Merged
Conversation
The Swagger docs were only reachable by running the server locally or by being inside the VPN to hit the deployment's /swagger/. Publish the spec that is already committed as a static Swagger UI site instead, so the API reference is readable from a URL. It renders server/docs/swagger.json verbatim rather than regenerating it, so the page always matches the surface the deployed binary embeds and serves. Swagger UI's own assets are vendored into the artifact at build time from a pinned swagger-ui-dist, so the published page loads nothing from a third-party CDN at runtime. Try it out and Authorize are hidden: the spec's host is the local dev server, so submitting would fire requests at the reader's own machine. The per-operation padlocks stay, so it is still visible which endpoints need a token. The workflow is deliberately outside the CI -> Publish -> Deploy chain. It holds no packages permission, touches no slot, and never runs on the self-hosted runner. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Docker build regenerates the spec from the handler annotations, so the deployed binary always serves a current one. But server/docs is also committed, and the Pages site publishes that committed copy -- nothing forced the two to agree, so annotations could change without a follow-up swag init and the published reference would drift from the real API with no signal. Regenerating with the pinned version proves the gap was already real: models.TaxonomyDetail.subsections, added with the A&E subsection strip, was missing from the committed spec. Commit the regenerated output along with the check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Swagger docs are currently only reachable by running the server locally or by being inside the VPN to hit the deployment's
/swagger/. This publishes the already-committed spec as a static Swagger UI site at https://drexeltriangle.github.io/triangle-cms/.What's here
.github/workflows/pages.yml— on pushes tomaintouching the spec, the page, or itself, assemblesserver/docs/swagger.jsonplus a vendored, version-pinnedswagger-ui-distinto a site and deploys it.docs/api/index.html— the Swagger UI shell. Assets load from alongside it, so the published page hits no third-party CDN at runtime..github/workflows/README.md.Deliberate choices
It renders the committed spec rather than regenerating it. That keeps the page matching the surface the deployed binary embeds and serves. The tradeoff: nothing in CI verifies the committed spec is current, so annotations changed without a follow-up
swag initgo stale silently. Happy to add a regenerate-and-diff CI check as a follow-up if that's wanted."Try it out" and Authorize are hidden. The spec's
@hostislocalhost:8080, so submitting would fire requests at the reader's own machine. Per-operation padlocks stay, so it's still visible which endpoints need a token. If this should be a live client instead, the fix is pointing@hostat the real hostname — butcms.thetriangle.orgisn't live yet (deploy/nginx/triangle-cms.confstill hasserver_name _), so there's nothing correct to put there today.The workflow sits outside the CI → Publish → Deploy chain. No
packagespermission, no slot, never on the self-hosted runner.Note
The repo is already public, so the spec isn't newly exposed — but this does give the full API surface a crawlable URL.
Testing
Assembled the site locally with the workflow's exact steps, served it, and rendered it headless: all 54 paths render grouped by tag, with no submit controls.
🤖 Generated with Claude Code