import { NextFunction, Request, Response } from "./router-types"; export type SwaggerSchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object" | "null"; interface SwaggerBaseSchema { description?: string; example?: any; default?: any; enum?: any[]; allOf?: SwaggerSchema[]; oneOf?: SwaggerSchema[]; anyOf?: SwaggerSchema[]; not?: SwaggerSchema; } export interface SwaggerGenericRefSchema { $ref: string; } export interface SwaggerStringSchema extends SwaggerBaseSchema { type: "string"; format?: "date" | "date-time" | string; minLength?: number; maxLength?: number; pattern?: string; } export interface SwaggerNumberSchema extends SwaggerBaseSchema { type: "number"; minimum?: number; maximum?: number; exclusiveMinimum?: boolean; exclusiveMaximum?: boolean; multipleOf?: number; } export interface SwaggerIntegerSchema extends SwaggerBaseSchema { type: "integer"; minimum?: number; maximum?: number; exclusiveMinimum?: boolean; exclusiveMaximum?: boolean; multipleOf?: number; } export interface SwaggerBooleanSchema extends SwaggerBaseSchema { type: "boolean"; } export interface SwaggerNullSchema extends SwaggerBaseSchema { type: "null"; } export interface SwaggerArraySchema extends SwaggerBaseSchema { type: "array"; items: SwaggerSchema; minItems?: number; maxItems?: number; uniqueItems?: boolean; } export interface SwaggerObjectSchema extends SwaggerBaseSchema { type: "object"; required?: string[]; properties?: Record; additionalProperties?: boolean | SwaggerSchema; } export type SwaggerSchema = SwaggerStringSchema | SwaggerNumberSchema | SwaggerIntegerSchema | SwaggerBooleanSchema | SwaggerArraySchema | SwaggerObjectSchema | SwaggerNullSchema | SwaggerGenericRefSchema; export type SwaggerHttpStatusCode = 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511; export interface SwaggerRequestBody { $ref?: string; required?: boolean; content?: Record; }>; } export interface SwaggerResponse { $ref?: string; description?: string; content?: Record; }>; headers?: Record; links?: Record; requestBody?: any; description?: string; server?: { url: string; description?: string; }; }>; } export interface SwaggerParameter { $ref?: string; name?: string; in?: "query" | "header" | "path" | "cookie"; required?: boolean; description?: string; deprecated?: boolean; allowEmptyValue?: boolean; style?: string; explode?: boolean; allowReserved?: boolean; schema?: SwaggerSchema; example?: any; examples?: Record; } export interface SwaggerApiKeySecurityScheme { type: "apiKey"; name: string; in: "query" | "header" | "cookie"; description?: string; } export interface SwaggerHttpSecurityScheme { type: "http"; scheme: "basic" | "bearer" | string; bearerFormat?: string; description?: string; } export interface SwaggerOAuth2SecurityScheme { type: "oauth2"; flows: { implicit?: { authorizationUrl: string; scopes: Record; }; password?: { tokenUrl: string; scopes: Record; }; clientCredentials?: { tokenUrl: string; scopes: Record; }; authorizationCode?: { authorizationUrl: string; tokenUrl: string; refreshUrl?: string; scopes: Record; }; }; description?: string; } export interface SwaggerOpenIdConnectSecurityScheme { type: "openIdConnect"; openIdConnectUrl: string; description?: string; } export type SwaggerSecurityScheme = SwaggerApiKeySecurityScheme | SwaggerHttpSecurityScheme | SwaggerOAuth2SecurityScheme | SwaggerOpenIdConnectSecurityScheme; export interface SwaggerOperation { tags?: string[]; summary?: string; description: string; externalDocs?: { description?: string; url: string; }; operationId?: string; parameters?: SwaggerParameter[]; requestBody?: SwaggerRequestBody; responses: { [status in SwaggerHttpStatusCode]?: SwaggerResponse; }; callbacks?: Record>>; deprecated?: boolean; security?: Array>; servers?: Array<{ url: string; description?: string; variables?: Record; }>; } export interface SwaggerOpenAPIConfig { openapi?: string; info: { title: string; version: string; description?: string; termsOfService?: string; contact?: { name?: string; url?: string; email?: string; }; license?: { name: string; url: string; }; }; servers?: Array<{ url: string; description?: string; variables?: Record; }>; components?: { schemas?: Record; responses?: Record; parameters?: Record; examples?: Record; requestBodies?: Record; headers?: Record; }>; securitySchemes?: Record; links?: Record; requestBody?: any; description?: string; server?: { url: string; description?: string; }; }>; callbacks?: Record>>; }; security?: Array>; tags?: Array<{ name: string; description?: string; externalDocs?: { description?: string; url: string; }; }>; externalDocs?: { description?: string; url: string; }; } export interface SwaggerOpenAPIDocument extends Omit { openapi: string; paths: Record>; } export interface SwaggerListenConfig { port: number; path?: string; callback?: () => Promise | void; } export interface SwaggerRouteBuilder { post: (options: SwaggerOperation) => SwaggerRouteBuilder; put: (options: SwaggerOperation) => SwaggerRouteBuilder; patch: (options: SwaggerOperation) => SwaggerRouteBuilder; get: (options: SwaggerOperation) => SwaggerRouteBuilder; delete: (options: SwaggerOperation) => SwaggerRouteBuilder; head: (options: SwaggerOperation) => SwaggerRouteBuilder; options: (options: SwaggerOperation) => SwaggerRouteBuilder; } export interface VkrunSwaggerUi { route: (path: string) => SwaggerRouteBuilder; serve: (absolutePath: string) => (req: Request, res: Response, next: NextFunction) => void; } export {};