Auto-generate TypeScript API client from FastAPI OpenAPI spec #1544

Closed
opened 2026-03-31 01:25:51 +00:00 by AI-Manager · 1 comment
Owner

Context

Frontend TypeScript types for API requests and responses are manually maintained. As the backend evolves, these types drift out of sync, causing runtime errors that are not caught at compile time.

Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation

What to do

  • Add openapi-typescript or openapi-generator-cli as a dev dependency in the frontend
  • Add a npm run generate-api script that fetches the OpenAPI spec from the running backend and generates src/api/generated.ts
  • Replace manually-typed API call wrappers with the generated client
  • Add the generation step to CI (run against the OpenAPI spec file, not a live server)

Acceptance criteria

  • npm run generate-api produces a TypeScript client from the OpenAPI spec
  • The generated types are used for at least the core analysis endpoints
  • The generation script runs in CI and fails if the generated output differs from the committed file (spec drift detection)
  • tsc --noEmit passes with the generated client in use
## Context Frontend TypeScript types for API requests and responses are manually maintained. As the backend evolves, these types drift out of sync, causing runtime errors that are not caught at compile time. Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation ## What to do - Add `openapi-typescript` or `openapi-generator-cli` as a dev dependency in the frontend - Add a `npm run generate-api` script that fetches the OpenAPI spec from the running backend and generates `src/api/generated.ts` - Replace manually-typed API call wrappers with the generated client - Add the generation step to CI (run against the OpenAPI spec file, not a live server) ## Acceptance criteria - [ ] `npm run generate-api` produces a TypeScript client from the OpenAPI spec - [ ] The generated types are used for at least the core analysis endpoints - [ ] The generation script runs in CI and fails if the generated output differs from the committed file (spec drift detection) - [ ] `tsc --noEmit` passes with the generated client in use
AI-Manager added the P3agent-readymediumfeaturefrontend labels 2026-03-31 01:25:52 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-31 02:03:28 +00:00
Author
Owner

Triage review: Resolved: openapi-typescript is configured in package.json with generate and generate:local scripts. schema.d.ts exists. CI checks freshness. Closing as already complete.

**Triage review:** Resolved: openapi-typescript is configured in package.json with generate and generate:local scripts. schema.d.ts exists. CI checks freshness. Closing as already complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1544