feat(ui): include internal routes in the dashboard's generated OpenAPI types (#29885)
The dashboard calls UI-internal proxy routes that the public /openapi.json hides with include_in_schema=False, so they never reached schema.d.ts and could not be typed. The type generator now force-includes those routes when it dumps the spec for openapi-typescript; this mutates a throwaway interpreter only, so the spec the proxy actually serves is unchanged. Regenerates schema.d.ts so 86 internal route families (for example /v2/model/info, /global/spend/*, /config/*, /v2/login, /sso/*) are now typed, with no public route removed. This unblocks migrating the dashboard's data fetching onto the typed $api client. Branch CI note: schema.d.ts is generated; CI regenerates and diffs it via the same gen:api script.
This commit is contained in:
parent
5e2db7eee4
commit
aaf1e2444b
@ -23,9 +23,17 @@ const specDir = mkdtempSync(join(tmpdir(), "litellm-openapi-"));
|
||||
const specPath = join(specDir, "openapi.json");
|
||||
|
||||
const python = (process.env.LITELLM_PYTHON ?? "python3").split(" ");
|
||||
// The dashboard calls internal UI routes that the public /openapi.json hides via
|
||||
// include_in_schema=False. Force them in so they get typed here; this mutates a
|
||||
// throwaway interpreter, so the spec the proxy actually serves is unchanged.
|
||||
const dumpSpec = [
|
||||
"import json, sys",
|
||||
"from litellm.proxy.proxy_server import app",
|
||||
"from fastapi.routing import APIRoute",
|
||||
"for route in app.routes:",
|
||||
" if isinstance(route, APIRoute):",
|
||||
" route.include_in_schema = True",
|
||||
"app.openapi_schema = None",
|
||||
"with open(sys.argv[1], 'w') as f: json.dump(app.openapi(), f, sort_keys=True)",
|
||||
].join("\n");
|
||||
|
||||
|
||||
5534
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
5534
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user