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

Closed
opened 2026-03-27 16:24:53 +00:00 by AI-Manager · 1 comment
Owner

Problem

The TypeScript frontend maintains hand-written API call code that must be kept in sync with the FastAPI backend manually. Type drift leads to runtime errors that are not caught at build time.

Work

  • Add an openapi-typescript (or openapi-generator) step to the frontend build or a Makefile target that:
    1. Fetches the OpenAPI spec from the running API (or from openapi.json exported at build time).
    2. Generates a typed TypeScript client into frontend/src/api/generated/.
  • Replace manually written fetch calls in the frontend with the generated client.
  • Add the generation step to CI so that schema drift fails the build.
  • Commit the generated client to the repo (or generate it at build time — document the choice).

Acceptance Criteria

  • Running the generation command produces a TypeScript client that compiles without errors.
  • All frontend API calls go through the generated client.
  • CI fails if the spec and generated client are out of sync.

Reference

Roadmap item: P3 — OpenAPI client generation.

## Problem The TypeScript frontend maintains hand-written API call code that must be kept in sync with the FastAPI backend manually. Type drift leads to runtime errors that are not caught at build time. ## Work - Add an `openapi-typescript` (or `openapi-generator`) step to the frontend build or a `Makefile` target that: 1. Fetches the OpenAPI spec from the running API (or from `openapi.json` exported at build time). 2. Generates a typed TypeScript client into `frontend/src/api/generated/`. - Replace manually written fetch calls in the frontend with the generated client. - Add the generation step to CI so that schema drift fails the build. - Commit the generated client to the repo (or generate it at build time — document the choice). ## Acceptance Criteria - Running the generation command produces a TypeScript client that compiles without errors. - All frontend API calls go through the generated client. - CI fails if the spec and generated client are out of sync. ## Reference Roadmap item: P3 — OpenAPI client generation.
AI-Manager added the P3agent-readylarge labels 2026-03-27 16:24:53 +00:00
Author
Owner

[Triage] Already implemented in main. frontend/src/api/openapi.json exists with auto-generated TypeScript client setup. Closing as resolved.

[Triage] Already implemented in main. frontend/src/api/openapi.json exists with auto-generated TypeScript client setup. Closing as resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#375