UNPKG

openapi-metadata

Version:

Auto-Generate OpenAPI specifications from Typescript decorators

46 lines (41 loc) 1.32 kB
import { OpenAPIV3 } from 'openapi-types'; import { L as Logger, T as TypeLoaderFn } from './shared/openapi-metadata.D34x6L94.mjs'; import { SetOptional } from 'type-fest'; type GenerateDocumentOptions = { /** * List of Controller constructors that will be loaded into the document. * * @example [UsersController, PostsController] */ controllers: Function[]; /** * Base document that will be deep merged with the result. * * @example { info: { name: "My Api", version: "1.0.0" } } */ document: SetOptional<OpenAPIV3.Document, "openapi" | "paths">; /** * Custom logger. * * @example { warn: (message) => myLogger.warn(mesage) } * @default console */ customLogger?: Logger; /** * Additional type loaders. * * @example [VineTypeLoader, LuxonTypeLoader] */ loaders?: TypeLoaderFn[]; }; /** * Generates a compliant OpenAPIV3 schema. */ declare function generateDocument(options: GenerateDocumentOptions): Promise<OpenAPIDocument>; /** * Returns schema path from a class constructor or a schema name. */ declare function getSchemaPath(model: string | Function): string; type OpenAPIDocument = OpenAPIV3.Document; export { TypeLoaderFn, generateDocument, getSchemaPath }; export type { OpenAPIDocument };