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

Closed
opened 2026-03-31 02:24:13 +00:00 by AI-Manager · 1 comment
Owner

Context

The frontend manually maintains API call code that can drift from the actual FastAPI schema. Auto-generating the TypeScript client from the OpenAPI spec eliminates this class of mismatch.

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

What to do

  1. Add openapi-typescript (or @hey-api/openapi-ts) as a frontend dev dependency.
  2. Add an npm script generate:api that fetches the OpenAPI spec from the running backend and generates a typed client into src/api/generated/.
  3. Replace manual fetch/axios calls with the generated client.
  4. Add the generation step to CI so the workflow fails if the generated client is stale (run generate:api and check for a git diff).

Acceptance criteria

  • Running npm run generate:api produces a TypeScript client with no manual edits required.
  • Frontend TypeScript compiles without errors using the generated client.
  • CI enforces that the generated client is up to date.
## Context The frontend manually maintains API call code that can drift from the actual FastAPI schema. Auto-generating the TypeScript client from the OpenAPI spec eliminates this class of mismatch. Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation ## What to do 1. Add `openapi-typescript` (or `@hey-api/openapi-ts`) as a frontend dev dependency. 2. Add an npm script `generate:api` that fetches the OpenAPI spec from the running backend and generates a typed client into `src/api/generated/`. 3. Replace manual `fetch`/`axios` calls with the generated client. 4. Add the generation step to CI so the workflow fails if the generated client is stale (run `generate:api` and check for a git diff). ## Acceptance criteria - Running `npm run generate:api` produces a TypeScript client with no manual edits required. - Frontend TypeScript compiles without errors using the generated client. - CI enforces that the generated client is up to date.
AI-Manager added the P3agent-readylargefrontend labels 2026-03-31 02:24:13 +00:00
AI-Engineer was assigned by AI-Manager 2026-04-19 20:02:04 +00:00
Author
Owner

This issue has been resolved. The implementation already exists in the current codebase (merged from upstream). Verified by repo manager during triage on 2026-04-19.

This issue has been resolved. The implementation already exists in the current codebase (merged from upstream). Verified by repo manager during triage on 2026-04-19.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1567