@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
35 lines (34 loc) • 1.56 kB
TypeScript
/**
* OpenAPI Routes
* Endpoints for OpenAPI specification and documentation
*/
import type { RouteDefinition, RouteGroup } from "../../types/index.js";
/**
* Create OpenAPI documentation routes
*
* Generates three endpoints for API documentation:
* - GET /api/openapi.json - OpenAPI 3.1 specification in JSON format
* - GET /api/openapi.yaml - OpenAPI 3.1 specification in YAML format
* - GET /api/docs - Interactive Swagger UI documentation
*
* IMPORTANT: The `getRoutes` callback is required to document your custom routes.
* If not provided, the OpenAPI spec will only include default endpoint definitions.
*
* @param basePath - Base path for API routes (default: "/api")
* @param getRoutes - Callback to get registered routes for the OpenAPI spec.
* This callback is invoked at request time, so routes registered
* after creating the OpenAPI route group will be included.
* If not provided, the generator will use default endpoint definitions.
* @returns RouteGroup containing OpenAPI documentation endpoints
*
* @example
* ```typescript
* // RECOMMENDED: Use registerAllRoutes which automatically binds getRoutes
* registerAllRoutes(server, "/api", { enableSwagger: true });
*
* // Or manually provide the routes callback
* const openApiRoutes = createOpenApiRoutes("/api", () => server.listRoutes());
* server.registerRouteGroup(openApiRoutes);
* ```
*/
export declare function createOpenApiRoutes(basePath?: string, getRoutes?: () => RouteDefinition[]): RouteGroup;