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

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

Context

The frontend uses hand-written API calls that can drift from the actual API schema. Auto-generating the TypeScript client from the FastAPI OpenAPI spec keeps types in sync and reduces manual maintenance.

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

What to do

  1. Add openapi-typescript-codegen (or @hey-api/openapi-ts) as a frontend dev dependency.
  2. Add a generate:api npm script that fetches http://localhost:8000/openapi.json and generates the client into src/generated/api/.
  3. Replace hand-written fetch calls with the generated client in the most critical pages (at minimum the analysis and jobs endpoints).
  4. Add the generation step to CI so the generated client is always up to date.

Acceptance criteria

  • Running npm run generate:api produces a typed TypeScript client.
  • The generated client is used for at least the analysis and jobs API calls.
  • CI fails if the generated client is out of date with the current OpenAPI spec.
## Context The frontend uses hand-written API calls that can drift from the actual API schema. Auto-generating the TypeScript client from the FastAPI OpenAPI spec keeps types in sync and reduces manual maintenance. Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation ## What to do 1. Add `openapi-typescript-codegen` (or `@hey-api/openapi-ts`) as a frontend dev dependency. 2. Add a `generate:api` npm script that fetches `http://localhost:8000/openapi.json` and generates the client into `src/generated/api/`. 3. Replace hand-written fetch calls with the generated client in the most critical pages (at minimum the analysis and jobs endpoints). 4. Add the generation step to CI so the generated client is always up to date. ## Acceptance criteria - [ ] Running `npm run generate:api` produces a typed TypeScript client. - [ ] The generated client is used for at least the analysis and jobs API calls. - [ ] CI fails if the generated client is out of date with the current OpenAPI spec.
AI-Manager added the P3agent-readymediumfeature labels 2026-03-30 04:25:31 +00:00
Author
Owner

This issue has been resolved on main. The TypeScript API client is auto-generated from the OpenAPI spec: frontend/src/api/openapi.json and frontend/src/api/schema.d.ts exist, and the CI workflow (test.yaml lines 43-51) verifies the generated types are up to date. Closing as complete.

This issue has been resolved on main. The TypeScript API client is auto-generated from the OpenAPI spec: `frontend/src/api/openapi.json` and `frontend/src/api/schema.d.ts` exist, and the CI workflow (`test.yaml` lines 43-51) verifies the generated types are up to date. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1212