If stratum-mining/sv2-apps#469 gets merged, we should stop manually maintaining monitoring API types and instead generate them from openapi.json as the single source of truth.
The current src/types/api.ts will inevitably drift from the real API and creates unnecessary maintenance overhead.
We can commit the OpenAPI specs from Translator and JDC into src/api-specs/monitoring/{translator,jdc}/openapi.json, updating them only when upstream changes (we will be notified via issue).
Then add a generate:types script using a tool like @hey-api/openapi-ts (or equivalent) to generate TypeScript types into src/api/generated, and replace all manual types with the generated ones. This step introduces no runtime changes.
After that, we can progressively replace fetchWithTimeout<T>() calls with a generated client (e.g. translatorClient.v1.global()), removing manual generics and endpoint duplication.
Proxies (/translator-api, /jdc-api) remain unchanged. The goal is to eliminate drift and reduce complexity by making OpenAPI the only source of truth and treating generated code as disposable.
If stratum-mining/sv2-apps#469 gets merged, we should stop manually maintaining monitoring API types and instead generate them from
openapi.jsonas the single source of truth.The current
src/types/api.tswill inevitably drift from the real API and creates unnecessary maintenance overhead.We can commit the OpenAPI specs from Translator and JDC into
src/api-specs/monitoring/{translator,jdc}/openapi.json, updating them only when upstream changes (we will be notified via issue).Then add a
generate:typesscript using a tool like@hey-api/openapi-ts(or equivalent) to generate TypeScript types intosrc/api/generated, and replace all manual types with the generated ones. This step introduces no runtime changes.After that, we can progressively replace
fetchWithTimeout<T>()calls with a generated client (e.g.translatorClient.v1.global()), removing manual generics and endpoint duplication.Proxies (
/translator-api,/jdc-api) remain unchanged. The goal is to eliminate drift and reduce complexity by making OpenAPI the only source of truth and treating generated code as disposable.