diff --git a/src/openapi.ts b/src/openapi.ts index d99e9c7..55c411b 100644 --- a/src/openapi.ts +++ b/src/openapi.ts @@ -294,8 +294,10 @@ export function toOpenAPISchema( // @ts-ignore const definitions = app.getGlobalDefinitions?.().type - // @ts-ignore private property - const routes = app.getGlobalRoutes() + // Use getFlattenedRoutes() if available (Elysia 1.4.16+) to get guard() schemas + // Falls back to getGlobalRoutes() for older versions + // @ts-expect-error - getFlattenedRoutes is a protected method not in public types + const routes = app.getFlattenedRoutes?.() ?? app.getGlobalRoutes() if (references) { if (!Array.isArray(references)) references = [references]