forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #635
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?
Context
The frontend manually duplicates API types and fetch calls. When the backend schema changes, the frontend drifts silently. Auto-generating the TypeScript client from the FastAPI OpenAPI spec would eliminate this drift.
Roadmap item: P3 > OpenAPI client generation
What to do
openapi-typescriptororvalto the frontend dev dependencies.package.json:"generate:api": "openapi-typescript http://localhost:8000/openapi.json -o src/api/generated.ts"(adjust path as needed).Acceptance criteria
npm run generate:apiproduces a valid TypeScript client file.tsc --noEmitusing the generated types.Closing: already implemented on main.
frontend/package.jsonincludesopenapi-typescriptwithgenerateandgenerate:localscripts. CI verifies the generated types are up to date.