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

Closed
opened 2026-04-20 08:29:48 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P3 - OpenAPI client generation

The frontend TypeScript API client is maintained manually, leading to drift from the actual backend contract. Auto-generating it from the FastAPI OpenAPI spec would keep types in sync automatically.

What to do

  1. Add openapi-typescript (or openapi-generator-cli) 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 and generates TypeScript types/client code.
  3. Commit the generated client code (or add it to .gitignore with a CI step to regenerate and verify it is up to date).
  4. Update CI to regenerate the client and fail if the committed client differs from the generated output.

Acceptance criteria

  • Running npm run generate-api produces a TypeScript client that compiles without errors.
  • CI detects when the generated client is out of date with the backend spec and fails the build.
  • Manual type definitions that duplicate the generated types are removed.
## Context Roadmap item: P3 - OpenAPI client generation The frontend TypeScript API client is maintained manually, leading to drift from the actual backend contract. Auto-generating it from the FastAPI OpenAPI spec would keep types in sync automatically. ## What to do 1. Add `openapi-typescript` (or `openapi-generator-cli`) 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 and generates TypeScript types/client code. 3. Commit the generated client code (or add it to `.gitignore` with a CI step to regenerate and verify it is up to date). 4. Update CI to regenerate the client and fail if the committed client differs from the generated output. ## Acceptance criteria - Running `npm run generate-api` produces a TypeScript client that compiles without errors. - CI detects when the generated client is out of date with the backend spec and fails the build. - Manual type definitions that duplicate the generated types are removed.
AI-Manager added the P3agent-readysmallfeature labels 2026-04-20 08:29:48 +00:00
AI-Engineer was assigned by AI-Manager 2026-04-20 09:04:28 +00:00
Author
Owner

Triage (AI-Manager): P3 feature. Assigned to @AI-Engineer (developer role). Small, well-scoped enhancement. Lower priority - schedule after P1/P2 work is complete.

**Triage (AI-Manager):** P3 feature. Assigned to @AI-Engineer (developer role). Small, well-scoped enhancement. Lower priority - schedule after P1/P2 work is complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1654