Embeds the Swagger UI 5.x distribution and the longue-vue OpenAPI spec, and
exposes two HTTP handlers used by cmd/longue-vue:
UIHandler() — serves the Swagger UI shell (HTML + JS/CSS assets)
from index.html (our bootstrap) and dist/ (vendored upstream).
OpenAPISpecHandler() — serves the embedded openapi.yaml.
Source of truth for the spec lives at api/openapi/openapi.yaml. The copy
under this package is generated by make swagger-sync and enforced by
make swagger-sync-check in CI.
Do not copy upstream index.html; ours lives in the parent dir.
Update dist/.version:
swagger-ui-<TAG>
<one-line change summary, e.g. "CVE-2025-xxxx fix">
Run make test and verify "Try it out" works against a local server.
Commit.
Why our index.html is outside dist/
Keeping the vendor surface pristine makes upgrades a straight directory
replacement with no patch to re-apply. The bootstrap (index.html) lives
one level up.
Package swagger embeds the Swagger UI 5.x distribution and the
longue-vue OpenAPI spec, and exposes HTTP handlers for serving both
(UIHandler for the shell, OpenAPISpecHandler for the spec).
See ADR-0025 and docs/superpowers/specs/2026-05-15-swagger-api-docs-design.md.
OpenAPISpecHandler serves the embedded OpenAPI 3.1 spec. Intended to be
mounted under `requireReadScope` + auth middleware so anonymous callers
get a 401, not the spec.
UIHandler serves the Swagger UI shell. Designed to be mounted at
/docs/ with http.StripPrefix("/docs", ...) so a request to /docs/ arrives
here as "/" and is served the index; a request to /docs/<asset> arrives
as /<asset> and is served from the embedded dist/ subtree.
Misses return 404 (no fallback to index.html) so broken vendor copies
surface loudly instead of silently rendering an empty Swagger UI shell.