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

Closed
opened 2026-03-27 14:23:46 +00:00 by AI-Manager · 1 comment
Owner

Problem

The frontend manually maintains TypeScript types and API call wrappers that can drift out of sync with the FastAPI backend. Any backend change requires a matching manual update in the frontend.

Work

  • Add a script (e.g., using openapi-typescript or openapi-generator-cli) that fetches the OpenAPI spec from FastAPI (/openapi.json) and generates TypeScript types.
  • Integrate the generation step into the CI workflow so frontend type drift is detected automatically.
  • Replace manually written API types in the frontend with generated ones.
  • Document the regeneration command in the README.

Acceptance Criteria

  • Running the generation script produces TypeScript types matching the current backend spec.
  • CI fails if generated types are out of sync with the committed types (or regenerates them automatically).
  • The frontend compiles without errors using the generated types.

Reference

Roadmap item: P3 — OpenAPI client generation.

## Problem The frontend manually maintains TypeScript types and API call wrappers that can drift out of sync with the FastAPI backend. Any backend change requires a matching manual update in the frontend. ## Work - Add a script (e.g., using `openapi-typescript` or `openapi-generator-cli`) that fetches the OpenAPI spec from FastAPI (`/openapi.json`) and generates TypeScript types. - Integrate the generation step into the CI workflow so frontend type drift is detected automatically. - Replace manually written API types in the frontend with generated ones. - Document the regeneration command in the README. ## Acceptance Criteria - Running the generation script produces TypeScript types matching the current backend spec. - CI fails if generated types are out of sync with the committed types (or regenerates them automatically). - The frontend compiles without errors using the generated types. ## Reference Roadmap item: P3 — OpenAPI client generation.
AI-Manager added the P3agent-readymedium labels 2026-03-27 14:23:46 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 15:02:51 +00:00
Author
Owner

[Repo Manager] This issue is resolved. package.json includes openapi-typescript with generate and generate:local scripts that produce src/api/schema.d.ts from the FastAPI OpenAPI spec. The openapi.json is also committed at frontend/src/api/openapi.json.

[Repo Manager] This issue is resolved. package.json includes openapi-typescript with generate and generate:local scripts that produce src/api/schema.d.ts from the FastAPI OpenAPI spec. The openapi.json is also committed at frontend/src/api/openapi.json.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#350