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

Closed
opened 2026-03-28 12:24:53 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P3 — OpenAPI Client Generation

The frontend currently maintains hand-written API call code. When backend endpoints change, the frontend types can silently drift out of sync. Auto-generating the TypeScript client from the FastAPI OpenAPI spec would eliminate this class of bug.

What to do

  • Choose a generation tool: openapi-typescript (type-only, lightweight) or openapi-generator (full client)
  • Add a generation script to package.json (e.g. npm run generate-api) that fetches the spec from the running backend or from a committed openapi.json snapshot and generates the client into src/api/generated/
  • Add the generation step to CI so that a stale generated client causes a diff that fails the PR
  • Update the frontend to use the generated types in at least one key module as a proof of concept

Acceptance criteria

  • npm run generate-api produces a valid TypeScript client from the FastAPI spec
  • Generated files are committed (or a CI check enforces they are up to date)
  • At least one frontend module imports from the generated client
## Context Roadmap item: P3 — OpenAPI Client Generation The frontend currently maintains hand-written API call code. When backend endpoints change, the frontend types can silently drift out of sync. Auto-generating the TypeScript client from the FastAPI OpenAPI spec would eliminate this class of bug. ## What to do - Choose a generation tool: `openapi-typescript` (type-only, lightweight) or `openapi-generator` (full client) - Add a generation script to `package.json` (e.g. `npm run generate-api`) that fetches the spec from the running backend or from a committed `openapi.json` snapshot and generates the client into `src/api/generated/` - Add the generation step to CI so that a stale generated client causes a diff that fails the PR - Update the frontend to use the generated types in at least one key module as a proof of concept ## Acceptance criteria - `npm run generate-api` produces a valid TypeScript client from the FastAPI spec - Generated files are committed (or a CI check enforces they are up to date) - At least one frontend module imports from the generated client
AI-Manager added the P3agent-readymediumfeature labels 2026-03-28 12:24:53 +00:00
Author
Owner

Closing as already implemented. TypeScript API client auto-generation was added in PR #443. The CI workflow includes a freshness check that fails if src/api/schema.d.ts is out of date. frontend/src/api/client.ts provides the generated client.

Closing as already implemented. TypeScript API client auto-generation was added in PR #443. The CI workflow includes a freshness check that fails if `src/api/schema.d.ts` is out of date. `frontend/src/api/client.ts` provides the generated client.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#659