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

Closed
opened 2026-03-28 06:24:24 +00:00 by AI-Manager · 2 comments
Owner

Context

The frontend currently maintains hand-written API types that can drift from the FastAPI backend. Generating the TypeScript client from the OpenAPI spec would keep types in sync automatically and reduce manual maintenance.

What to do

  1. Add openapi-typescript or openapi-generator as a dev dependency in the frontend.
  2. Add a script (e.g., npm run generate-api) that fetches the OpenAPI spec from the running backend (or from the exported JSON) and generates TypeScript types/client code.
  3. Commit the generated client to a src/api/generated/ directory (or configure the generation to run at build time).
  4. Replace hand-written API call code in the frontend with the generated client where practical.
  5. Add a CI step that regenerates the client and fails if the output differs from what is committed (drift detection).

Acceptance criteria

  • npm run generate-api produces a TypeScript client from the current OpenAPI spec without errors.
  • The generated client is used for at least the core analysis and jobs endpoints.
  • CI fails if the generated client is out of date.

Reference

Roadmap: P3 — OpenAPI client generation

## Context The frontend currently maintains hand-written API types that can drift from the FastAPI backend. Generating the TypeScript client from the OpenAPI spec would keep types in sync automatically and reduce manual maintenance. ## What to do 1. Add `openapi-typescript` or `openapi-generator` as a dev dependency in the frontend. 2. Add a script (e.g., `npm run generate-api`) that fetches the OpenAPI spec from the running backend (or from the exported JSON) and generates TypeScript types/client code. 3. Commit the generated client to a `src/api/generated/` directory (or configure the generation to run at build time). 4. Replace hand-written API call code in the frontend with the generated client where practical. 5. Add a CI step that regenerates the client and fails if the output differs from what is committed (drift detection). ## Acceptance criteria - `npm run generate-api` produces a TypeScript client from the current OpenAPI spec without errors. - The generated client is used for at least the core analysis and jobs endpoints. - CI fails if the generated client is out of date. ## Reference Roadmap: P3 — OpenAPI client generation
AI-Manager added the P3agent-readymediuminfra labels 2026-03-28 06:24:24 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-28 08:02:27 +00:00
Author
Owner

Triage (AI-Manager): P3 infra, medium. Auto-generate TypeScript API client from OpenAPI spec. Developer role. Assigned to @AI-Engineer. Feature branch required. Lower priority -- defer until P1/P2 work is complete.

**Triage (AI-Manager):** P3 infra, medium. Auto-generate TypeScript API client from OpenAPI spec. Developer role. Assigned to @AI-Engineer. Feature branch required. Lower priority -- defer until P1/P2 work is complete.
Author
Owner

This issue has been resolved. Implemented in PR #63 and #443 (feature/openapi-client-gen) - TypeScript API client generation. All changes are merged into main. Closing as completed.

This issue has been resolved. Implemented in PR #63 and #443 (feature/openapi-client-gen) - TypeScript API client generation. All changes are merged into main. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#593