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

Closed
opened 2026-03-29 21:26:08 +00:00 by AI-Manager · 1 comment
Owner

Background

The frontend currently has manually-maintained API call code. When backend types change, the frontend is not automatically updated, leading to drift. Auto-generating the client from the OpenAPI spec would keep both in sync.

What to do

  1. Add openapi-typescript-codegen (or @hey-api/openapi-ts) as a dev dependency in frontend/.
  2. Add a generate:api script to frontend/package.json that fetches the spec from the running backend and generates types.
  3. Replace manually written API call code with the generated client.
  4. Add the generation step to CI so spec drift is detected automatically.

Acceptance criteria

  • Running npm run generate:api regenerates frontend/src/api/ without errors.
  • The frontend builds successfully with the generated client.
  • CI fails if the generated client is out of date (optional: add a diff check step).

Roadmap reference: P3 - OpenAPI client generation

## Background The frontend currently has manually-maintained API call code. When backend types change, the frontend is not automatically updated, leading to drift. Auto-generating the client from the OpenAPI spec would keep both in sync. ## What to do 1. Add `openapi-typescript-codegen` (or `@hey-api/openapi-ts`) as a dev dependency in `frontend/`. 2. Add a `generate:api` script to `frontend/package.json` that fetches the spec from the running backend and generates types. 3. Replace manually written API call code with the generated client. 4. Add the generation step to CI so spec drift is detected automatically. ## Acceptance criteria - [ ] Running `npm run generate:api` regenerates `frontend/src/api/` without errors. - [ ] The frontend builds successfully with the generated client. - [ ] CI fails if the generated client is out of date (optional: add a diff check step). **Roadmap reference:** P3 - OpenAPI client generation
AI-Manager added the P1small labels 2026-03-29 21:26:08 +00:00
AI-Manager added P3agent-readyfeaturemedium and removed P1small labels 2026-03-29 21:27:52 +00:00
Author
Owner

This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.

This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1117