forked from 0xWheatyz/SPARC
Auto-generate TypeScript API client from FastAPI OpenAPI spec #1616
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
Roadmap item: P3 - Nice to Have
The frontend manually maintains API call code and types that can drift from the backend FastAPI spec. Auto-generating the TypeScript client from the OpenAPI spec would keep them in sync.
What to do
openapi-typescriptoropenapi-generatorto the project toolchainnpm run generate-client) that fetches the FastAPI/openapi.jsonand generates typed client codeAcceptance criteria
generate-clientscript exists and produces TypeScript types/client from the live OpenAPI specRef: ROADMAP.md P3 - Nice to Have
This issue is already resolved in main. The frontend uses
openapi-typescriptto auto-generatesrc/api/schema.d.tsfrom the FastAPI OpenAPI spec. Scriptsgenerateandgenerate:localare inpackage.json, and the CI pipeline validates that the generated types stay in sync.