import type { RouteSchemas, StandardSchemaV1 } from './schema'; /** OpenAPI metadata a route can declare (via its decorator options). */ export interface OperationMeta { /** One-line summary shown as the operation's title in docs UIs. */ summary?: string; /** Longer description; CommonMark/Markdown is rendered by docs UIs. */ description?: string; /** Tags that group the operation into sidebar sections in docs UIs. */ tags?: string[]; /** Explicit operation id; must be unique across the document and is reused as the generated client's method name. Falls back to a readable id derived from method + path (e.g. `getUsersId`) when omitted. */ operationId?: string; /** Flag the operation deprecated (docs UIs render it struck-through). */ deprecated?: boolean; } /** One mounted route, captured for OpenAPI generation. */ export interface OperationRecord { /** The HTTP method in uppercase (e.g. `GET`); lowercased when written as the path-item key. */ method: string; /** The normalized route pattern with `:name` params (e.g. `/users/:id`), converted to `/users/{id}` in the output. */ pattern: string; /** Standard Schemas declared for the route's inputs and output. */ schemas?: RouteSchemas; /** OpenAPI metadata declared on the route. */ meta?: OperationMeta; } /** The `info` block of the generated OpenAPI document. */ export interface OpenApiInfo { /** * API title. * @defaultValue `'turnover API'` */ title?: string; /** * API version. * @defaultValue `'0.0.0'` */ version?: string; /** API description. */ description?: string; } /** A server entry advertised in the OpenAPI document. */ export interface OpenApiServer { /** Base URL of the server. */ url: string; /** Human-readable description of the server. */ description?: string; } /** Options for building an OpenAPI document. */ export interface OpenApiOptions { /** Document metadata (`title`, `version`, `description`). */ info?: OpenApiInfo; /** Server entries to advertise. */ servers?: OpenApiServer[]; /** * Convert a route's Standard Schema into a JSON Schema for the document. * Standard Schema doesn't mandate a JSON-Schema export, so bring your own * (TypeBox schemas are already JSON Schema; Zod via `zod-to-json-schema`). * Schemas are omitted from the document when this is not provided. */ toJsonSchema?: (schema: StandardSchemaV1) => unknown; } /** A generated OpenAPI 3.1 document. */ export interface OpenApiDocument { /** The OpenAPI spec version — always the literal `"3.1.0"`. */ openapi: string; /** Document metadata with defaults resolved, so `title` and `version` are always present (unlike the all-optional {@link OpenApiInfo}). */ info: { title: string; version: string; description?: string; }; /** Advertised servers, if any. */ servers?: OpenApiServer[]; /** Path items keyed by path, each keyed by lowercased HTTP method. */ paths: Record>; } /** * Build an OpenAPI 3.1 document from mounted operations. * * @remarks * Path params are always emitted as `required` (typed from the route's `params` * schema, or `{ type: 'string' }` when it has none). A request body is marked * `required`. Every operation gets a single `200` response — carrying the * `response` schema when one is declared, otherwise just `{ description: 'OK' }`. * Input/output schemas appear only when `options.toJsonSchema` is supplied; * without it the document still has all paths, params, and metadata but no * request/response schemas. * * @param operations - the mounted route records to document * @param options - document info, servers, and a Standard-Schema-to-JSON-Schema converter * @returns the generated {@link OpenApiDocument} */ export declare function buildOpenApi(operations: readonly OperationRecord[], options?: OpenApiOptions): OpenApiDocument; //# sourceMappingURL=openapi.d.ts.map