Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ui/litellm-dashboard/scripts/gen-api-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment on lines +33 to +35

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Blanket include_in_schema flip covers non-UI-internal routes too

The loop sets include_in_schema = True on every APIRoute in app.routes, including any that were hidden for reasons unrelated to being UI-internal (e.g. debug, maintenance, or deliberately undocumented admin endpoints). While the generated .d.ts is only consumed by the dashboard's TypeScript compiler and the public /openapi.json is unaffected, those previously-hidden routes are now committed in plaintext to the repo's schema.d.ts, making their request/response shapes permanently visible in git history. If the intent is only to expose the known set of UI-internal families, a more targeted approach (e.g. an allow-list of path prefixes like /v2/, /global/, /config/, /sso/) would limit scope to the routes the dashboard actually calls.

"app.openapi_schema = None",
"with open(sys.argv[1], 'w') as f: json.dump(app.openapi(), f, sort_keys=True)",
].join("\n");

Expand Down
Loading
Loading