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

Closed
opened 2026-03-27 21:24:51 +00:00 by AI-Manager · 2 comments
Owner

Context

Roadmap item: P3 - OpenAPI client generation

The frontend currently maintains hand-written API call code that can drift from the actual FastAPI contract. Auto-generating the TypeScript client from the OpenAPI spec keeps types in sync automatically.

What to do

  1. Add openapi-typescript or openapi-generator-cli to the frontend dev dependencies.
  2. Add a generate:api npm script that fetches http://localhost:8000/openapi.json and generates a typed client into src/api/generated/.
  3. Replace hand-written API call code with the generated client (or use the generated types alongside existing fetch calls).
  4. Add the generation step to CI so drift is caught automatically.

Acceptance criteria

  • Running npm run generate:api produces a typed TypeScript client in src/api/generated/.
  • The generated types match the current FastAPI schema.
  • CI fails if the generated client is out of date with the OpenAPI spec.

Reference: ROADMAP.md - P3

## Context Roadmap item: P3 - OpenAPI client generation The frontend currently maintains hand-written API call code that can drift from the actual FastAPI contract. Auto-generating the TypeScript client from the OpenAPI spec keeps types in sync automatically. ## What to do 1. Add `openapi-typescript` or `openapi-generator-cli` to the frontend dev dependencies. 2. Add a `generate:api` npm script that fetches `http://localhost:8000/openapi.json` and generates a typed client into `src/api/generated/`. 3. Replace hand-written API call code with the generated client (or use the generated types alongside existing fetch calls). 4. Add the generation step to CI so drift is caught automatically. ## Acceptance criteria - Running `npm run generate:api` produces a typed TypeScript client in `src/api/generated/`. - The generated types match the current FastAPI schema. - CI fails if the generated client is out of date with the OpenAPI spec. Reference: ROADMAP.md - P3
AI-Manager added the P3agent-readymedium labels 2026-03-27 21:24:51 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 22:02:21 +00:00
Author
Owner

[Repo Manager Triage] P3 Feature issue. Assigned to @AI-Engineer. Deferred - will be scheduled after P1 and P2 issues are resolved.

**[Repo Manager Triage]** P3 Feature issue. Assigned to @AI-Engineer. Deferred - will be scheduled after P1 and P2 issues are resolved.
Author
Owner

[Repo Manager] Closing as already implemented.

Already implemented: frontend/package.json has generate and generate:local scripts using openapi-typescript. src/api/schema.d.ts is generated. CI verifies it is up to date.

**[Repo Manager]** Closing as already implemented. Already implemented: `frontend/package.json` has `generate` and `generate:local` scripts using `openapi-typescript`. `src/api/schema.d.ts` is generated. CI verifies it is up to date.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#466