UNPKG

kobp

Version:
55 lines (54 loc) 1.71 kB
import 'reflect-metadata'; import type { KobpRouter } from '../controllers'; import type { OpenApiBuilder, OpenAPIObject, SecurityRequirementObject, SecuritySchemeObject, ServerObject, TagObject } from 'openapi3-ts/oas31'; export declare type SwaggerMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS'; export declare type SkipPathPredicate = (path: string) => boolean; /** * Simplified swagger information */ export interface SwaggerGenerationOption { /** * version tag of this API */ version: string; /** * Description of this API * * this can be a string or a function * the string can be written in markdown */ description: string | ((defaultText: string) => string); /** * Skip methods */ skipMethods: SwaggerMethod[]; /** * Provided the path's prefix to remove from all * paths. */ basePath: string; /** * Skip paths */ skipPaths: (string | RegExp)[] | SkipPathPredicate; /** * server informations */ servers: ServerObject[]; /** * Available tags of the whole system */ availableTags: TagObject[]; /** * Security requirement that will be applied on all path */ securityOnAllOperations: SecurityRequirementObject[]; /** * Define security scheme for this API document. The list can be used by security requirement objects. */ securitySchemes: Record<string, SecuritySchemeObject>; } /** * Extract API specification from given router object */ export declare const deriveApiSpec: (title: string, someOptions: Partial<SwaggerGenerationOption>, builder: OpenApiBuilder, router: KobpRouter) => OpenAPIObject;