You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#47 shipped the projects routes (mock manager/store) that the #24 route-shell
PR was building, leaving #24 conflicting on nearly every file. The route shell
itself is now redundant, but two pieces of #24 are genuinely net-new and absent
from main — salvage them here, rebuilt on top of #47's merged code:
- Code-first OpenAPI: apispec/specgen reflects the controllers' request/response
types and project DTOs (the same types the handlers use at runtime) into
openapi.yaml via swaggest. `cmd/genspec` + `go:generate` regenerate the
committed, embedded spec; a drift test (TestBuild_MatchesEmbedded) and a route
parity test (TestRouteSpecParity) fail CI if the spec and the code disagree.
This replaces main's hand-maintained openapi.yaml so the "single source of
truth" claim is actually enforced, not aspirational.
- Typed frontend client: frontend/src/api/schema.d.ts is generated from that
spec via openapi-typescript (`npm run gen:api`), consumed by a small
openapi-fetch client. The frontend now gets its types from the daemon
contract instead of hand-maintaining them.
specgen lives outside apispec (which controllers import for the 501 stub) to
avoid an import cycle. Handlers now encode named response DTOs
(controllers/dto.go) instead of map[string]any so the generator reflects the
real wire shapes. A gen-verify CI job regenerates both artifacts and fails on a
stale commit.
Tradeoff: the generated spec drops the hand-authored examples / x-rest-audit
notes from #47's openapi.yaml; those can be re-added as operation metadata in
specgen if wanted. Behaviour-only patch (no handler logic changes).
Supersedes the codegen + frontend parts of #24. Refs #20, #47.
0 commit comments