UNPKG

express-swagger-autogen

Version:

A library that auto generates swagger docs to your endpoints from express.

30 lines (29 loc) 1.03 kB
import { Router } from "express"; import { OperationObject } from "openapi-typescript"; import z from "zod"; export interface HandlerDocumentation extends OperationObject { zod?: { requestBody?: z.ZodTypeAny; responses?: Record<string | number, z.ZodTypeAny>; params?: z.ZodTypeAny[]; }; } interface HandlerWithDocumentation extends Function { documentation?: HandlerDocumentation; } type ListedRoute = { path: string; method: string; handlers: HandlerWithDocumentation[]; }; export declare abstract class ExpressSwaggerAutogenUtils { static METADATA_KEY: symbol; static listRoutes(router: Router): ListedRoute[]; static extractPathParams: (path: string) => string[]; static extractFirstPathName: (path: string) => string; static normalizeSwaggerToExpressPath: (path: string) => string; static normalizeExpressToSwaggerPath: (path: string) => string; static merge: (target: any, source: any) => any; static logger: (message: string) => void; } export {};