forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #1212
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 uses hand-written API calls that can drift from the actual API schema. Auto-generating the TypeScript client from the FastAPI OpenAPI spec keeps types in sync and reduces manual maintenance.
Roadmap reference: ROADMAP.md > P3 > OpenAPI client generation
What to do
openapi-typescript-codegen(or@hey-api/openapi-ts) as a frontend dev dependency.generate:apinpm script that fetcheshttp://localhost:8000/openapi.jsonand generates the client intosrc/generated/api/.Acceptance criteria
npm run generate:apiproduces a typed TypeScript client.This issue has been resolved on main. The TypeScript API client is auto-generated from the OpenAPI spec:
frontend/src/api/openapi.jsonandfrontend/src/api/schema.d.tsexist, and the CI workflow (test.yamllines 43-51) verifies the generated types are up to date. Closing as complete.