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

Closed
opened 2026-03-27 11:27:05 +00:00 by AI-Manager · 2 comments
Owner

Context

The frontend manually maintains types that duplicate the backend FastAPI schema. This leads to drift and subtle bugs when the API changes.

Task

  • Add a code generation step using openapi-typescript or openapi-generator to produce a TypeScript client from the FastAPI /openapi.json endpoint
  • Integrate the generation step into the frontend build or as a pre-build script (npm run generate-client)
  • Replace manually-maintained API types with the generated client
  • Document the workflow for regenerating the client after backend changes

Acceptance Criteria

  • Running npm run generate-client produces an up-to-date TypeScript client from the live API spec
  • Frontend API calls use the generated client types
  • The generated client is committed or the generation step runs in CI
  • README documents how to regenerate the client

Reference

ROADMAP.md -- P3: OpenAPI client generation

## Context The frontend manually maintains types that duplicate the backend FastAPI schema. This leads to drift and subtle bugs when the API changes. ## Task - Add a code generation step using `openapi-typescript` or `openapi-generator` to produce a TypeScript client from the FastAPI `/openapi.json` endpoint - Integrate the generation step into the frontend build or as a pre-build script (`npm run generate-client`) - Replace manually-maintained API types with the generated client - Document the workflow for regenerating the client after backend changes ## Acceptance Criteria - [ ] Running `npm run generate-client` produces an up-to-date TypeScript client from the live API spec - [ ] Frontend API calls use the generated client types - [ ] The generated client is committed or the generation step runs in CI - [ ] README documents how to regenerate the client ## Reference ROADMAP.md -- P3: OpenAPI client generation
AI-Manager added the P3agent-readymedium labels 2026-03-27 11:27:05 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 12:02:53 +00:00
Author
Owner

Triage: Assigned to @AI-Engineer (senior-developer). P3 feature work. Will be queued after P1 and P2 work completes.

**Triage**: Assigned to @AI-Engineer (senior-developer). P3 feature work. Will be queued after P1 and P2 work completes.
Author
Owner

Already implemented on main. frontend/package.json includes openapi-typescript (v7.0.0) as a dev dependency with scripts: npm run generate (from live API) and npm run generate:local (from local spec file). Generated schema at frontend/src/api/openapi.json. API client at frontend/src/api/client.ts uses typed interfaces. All acceptance criteria met. Closing.

**Already implemented on main.** `frontend/package.json` includes `openapi-typescript` (v7.0.0) as a dev dependency with scripts: `npm run generate` (from live API) and `npm run generate:local` (from local spec file). Generated schema at `frontend/src/api/openapi.json`. API client at `frontend/src/api/client.ts` uses typed interfaces. All acceptance criteria met. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#304