Repository navigation
Milestone 2: OpenAPI code generation lift (oapi-codegen + openapi-typescript) - #3
Merged
Merged
Conversation
Backend (Go): - oapi-codegen generates types.gen.go (8k+ lines) and server.gen.go (11k+ lines) from docs/openapi/stig-manager.yaml - api.Unimplemented auto-returns 501 for all 150+ operations - APIServer embeds Unimplemented, overrides GetAppInfo + GetConfiguration - Server wires generated chi router at /api/* via HandlerFromMuxWithBaseURL - Dropped custom genstub generator in favour of oapi-codegen's built-in Unimplemented type - New server_test.go exercises health, appinfo, configuration, and 501 Frontend (TypeScript): - openapi-typescript generates src/lib/api/schema.ts (10k lines) - openapi-fetch typed client in src/lib/api/client.ts - fetchAppInfo migrated to typed client CI: - api workflow: verify generated Go code is up to date - web workflow: verify generated TS types are up to date - Both workflows trigger on docs/openapi/** changes Fixes API base path from /api/v1 to /api to match upstream spec. Co-Authored-By: Bryce Anglin <brycemanglin@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Node.js 22 -> 24 across web + docs CI workflows - Go 1.25.4 -> 1.26.3 in api CI and go.mod toolchain directive - Rename api/Dockerfile -> api/Containerfile and web/Dockerfile -> web/Containerfile (OCI image-spec naming; Podman/Buildah build natively, Docker builds via -f) - Update compose, READMEs, and architecture docs to reference Containerfile - Bump base images: golang:1.26.3-alpine, node:24-alpine, fully-qualified docker.io/library/* references for OCI registry portability - Mark Milestone 1 as Merged and Milestone 2 as In Review in roadmap All builds verified locally: - go build/vet/test on 1.26.3 (5 tests pass) - pnpm typecheck/lint/build/gen:api on Node 24 - pnpm --filter docs build (179 pages) Co-Authored-By: Bryce Anglin <brycemanglin@gmail.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.
Summary
Integrates code generation from the upstream OpenAPI v1 spec (
docs/openapi/stig-manager.yaml) into both the Go backend and the React frontend, and bumps the toolchain to Node 24 + Go 1.26.3 + OCI Containerfiles.Backend (Go):
oapi-codegengeneratestypes.gen.go(8,451 lines — all OpenAPI models) andserver.gen.go(11,198 lines — chiServerInterface+ route registration) from the upstream spec.api.Unimplementedtype returns 501 for all 150+ operations out of the box.APIServerininternal/server/api_server.goembeds it and overridesGetAppInfo+GetConfigurationwith real responses./api/*viaHandlerFromMuxWithBaseURL, replacing the Milestone 1 scaffold routes.server_test.gocovers/health,/api/op/appinfo,/api/op/configuration, and confirms unimplemented endpoints return 501.Frontend (TypeScript):
openapi-typescriptgeneratessrc/lib/api/schema.ts(10,089 lines) with full path/operation/component types.openapi-fetchprovides a type-safeapiClient(GET,POST, etc.) with autocompletion on paths and request parameters.fetchAppInfomigrated from rawfetch()to the typed client.Toolchain bump:
node:24-alpinebase image).go.modtoolchain directive;golang:1.26.3-alpinebase image).api/Dockerfile→api/Containerfile,web/Dockerfile→web/Containerfile(OCI image-spec naming so Podman/Buildah build natively; Docker still builds via-f).docker.io/library/*base image references for registry portability.API base path fix:
/api/v1to/apiacross all docs, README files, and code comments to match the upstream spec's server URL (http://localhost:64001/api).CI:
go generateand checksgit diff --quietto verify generated Go code is committed and up-to-date.pnpm gen:apiand checksgit diff --quietfor the TS schema.docs/openapi/**changes.Review & Testing Checklist for Human
podman build -t stigman-api -f api/Containerfile api/anddocker build -t stigman-api -f api/Containerfile api/should both succeed.cd deploy/compose && docker compose up -d --buildshould bring up the full stack on Node 24 / Go 1.26.3;curl http://localhost:54001/api/op/appinforeturns version JSON andcurl http://localhost:54001/api/collectionsreturns 501.cd api && go test ./... -race— all 5 tests pass on Go 1.26.3.pnpm --filter web typecheck && pnpm --filter web buildandpnpm --filter docs buildboth succeed on Node 24.Notes
api.Unimplementedis oapi-codegen's built-in stub — the customgenstubgenerator from earlier attempts has been removed.deploy preview / production(GitHub Pages deploy, only runs onmain).Link to Devin session: https://app.devin.ai/sessions/022810763c4643c0848ba894c1512b92
Requested by: @Exonical