/** * OpenAPI 3.1 document generator driven from the operation and direct-route * models. * * Produces a JSON-serializable OpenAPI document for the REST-ish HTTP * surface. Both `handleRequest()` and `serve()` expose this at * `GET /openapi.json`. Every operation-catalog binding carries the canonical * `x-weft-access` metadata and, when applicable, * `x-weft-parameterizedAccess`; direct infrastructure routes do not. * * @module server/openapi */ import { type DiscoveryInfo } from './discovery-info.ts'; import { type OpenApiSchemaHelper } from './openapi-schemas.ts'; import type { OperationRegistry } from './operation-catalog.ts'; import type { UnknownRestBinding } from './rest-bindings.ts'; export type OpenApiSecuritySchemeName = 'bearerAuth' | 'apiKeyAuth'; /** Options for customizing the generated OpenAPI document. */ export type OpenApiOptions = { /** API title. Defaults to `'Weft Workflow Engine'`. */ title?: string; /** API version. Defaults to the current Weft package version. */ version?: string; /** Operator-supplied discovery metadata applied to the generated document. */ discoveryInfo?: DiscoveryInfo; /** Operation registry used to emit operation-backed REST bindings. */ registry?: OperationRegistry; /** * REST bindings used to emit OpenAPI path items. Defaults to * `createLiveRestBindings()`. Servers that override their binding set * (e.g. for a restricted subset) should pass the same set here so * `/openapi.json` matches the live HTTP surface. */ restBindings?: ReadonlyArray; /** Server URL. When omitted, no `servers` array is included. */ serverUrl?: string; /** * Security schemes the live server actually supports. When omitted, * emit both current API-key scheme names so generated clients can choose * either header-oriented convention. */ supportedSchemes?: ReadonlySet; }; /** * Emit REST bindings into the OpenAPI paths map. Exported for tests; * `generateOpenApiDocument` is the production entry point. * * @internal */ export declare function emitBindings(paths: Record>, tagSet: Set, bindings?: ReadonlyArray, registry?: OperationRegistry, schemaHelper?: OpenApiSchemaHelper): void; export declare function generateOpenApiDocument(options?: OpenApiOptions): Record;