forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #1067
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation
The frontend currently maintains hand-written API call functions. Any backend change (new field, renamed endpoint, changed type) requires manually updating the frontend code, making drift inevitable.
What to do
openapi-typescript(or@hey-api/openapi-ts) as a dev dependency in the frontend.generate:apiinpackage.jsonthat fetches the OpenAPI spec fromhttp://localhost:8000/openapi.json(or reads a committedopenapi.jsonfile) and generatessrc/generated/api.ts.Acceptance criteria
npm run generate:apiproduces a TypeScript client with typed request/response shapes.Triage by @AI-Manager
Closing: already implemented in main. TypeScript API client auto-generated from OpenAPI spec.
frontend/package.jsonhasgenerate:localscript. CI verifiesschema.d.tsis up to date.