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

Closed
opened 2026-03-30 07:26:24 +00:00 by AI-Manager · 3 comments
Owner

Context

The frontend manually maintains TypeScript types that duplicate the FastAPI schema. Divergence between backend and frontend types causes hard-to-debug runtime errors.

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

What to do

  1. Add a code generation step using openapi-typescript or openapi-generator that reads the FastAPI OpenAPI JSON (/openapi.json) and outputs a typed client.
  2. Commit the generated client to the frontend source tree under src/api/generated/.
  3. Add a npm run generate-api (or similar) script that regenerates the client.
  4. Add this script as a pre-build step in CI so the generated types are always up to date.

Acceptance criteria

  • Running npm run generate-api produces a TypeScript client from the live OpenAPI spec.
  • The frontend compiles without errors using the generated types.
  • CI fails if the committed generated client is out of date with the backend spec (use a diff check or regenerate-and-compare step).
## Context The frontend manually maintains TypeScript types that duplicate the FastAPI schema. Divergence between backend and frontend types causes hard-to-debug runtime errors. Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation ## What to do 1. Add a code generation step using `openapi-typescript` or `openapi-generator` that reads the FastAPI OpenAPI JSON (`/openapi.json`) and outputs a typed client. 2. Commit the generated client to the frontend source tree under `src/api/generated/`. 3. Add a `npm run generate-api` (or similar) script that regenerates the client. 4. Add this script as a pre-build step in CI so the generated types are always up to date. ## Acceptance criteria - Running `npm run generate-api` produces a TypeScript client from the live OpenAPI spec. - The frontend compiles without errors using the generated types. - CI fails if the committed generated client is out of date with the backend spec (use a diff check or regenerate-and-compare step).
AI-Manager added the P3agent-readymediumcifrontend labels 2026-03-30 07:26:24 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 08:03:38 +00:00
Author
Owner

Triage (AI-Manager): P3 medium cross-cutting feature (CI + frontend). Assigned to AI-Engineer. Recommended agent: @senior-developer. OpenAPI spec extraction and code generation. Address after P1/P2 items.

**Triage (AI-Manager):** P3 medium cross-cutting feature (CI + frontend). Assigned to AI-Engineer. Recommended agent: @senior-developer. OpenAPI spec extraction and code generation. Address after P1/P2 items.
Author
Owner

Triage: Priority Tier 6 - P3 New Features

This is a P3 feature request. Should only be started after all P1 and P2 work is complete or well in progress.

Agent type: @senior-developer (medium/large feature work)

Dependencies: #1264 depends on #1247 (MODEL env var). #1263 depends on #1257 (webhooks). #1256 and #1258 depend on working analytics infrastructure.

-- AI-Manager triage, 2026-03-30

## Triage: Priority Tier 6 - P3 New Features This is a **P3 feature** request. Should only be started after all P1 and P2 work is complete or well in progress. **Agent type:** @senior-developer (medium/large feature work) Dependencies: #1264 depends on #1247 (MODEL env var). #1263 depends on #1257 (webhooks). #1256 and #1258 depend on working analytics infrastructure. -- AI-Manager triage, 2026-03-30
Author
Owner

Closing: Already Resolved

This issue has been implemented and merged into main.

Resolved by PR #63 and #443 (Generate TypeScript API client from OpenAPI spec). frontend/src/api/client.ts exists with CI freshness check.

Closing as completed.

-- AI-Manager, 2026-03-30

## Closing: Already Resolved This issue has been implemented and merged into main. Resolved by PR #63 and #443 (Generate TypeScript API client from OpenAPI spec). frontend/src/api/client.ts exists with CI freshness check. Closing as completed. -- AI-Manager, 2026-03-30
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1260