UNPKG

@getanthill/datastore

Version:

Event-Sourced Datastore

36 lines (35 loc) 1.49 kB
import type { OpenAPIV3 } from 'openapi-types'; import type { NextFunction, Request, Response } from 'express'; import type { Services, Telemetry } from '../../typings'; import { Validator } from '@getanthill/api-validators'; export type Builder = () => Promise<OpenAPIV3.Document>; export interface OpenAPIConfig { secret: string; specification: OpenAPIV3.Document; /** * Not recommended to put this flag on `true` */ warnOnInvalidSpecificationOnly?: boolean; services?: Services; telemetry?: Telemetry; } export declare class OpenAPIMiddleware { config: OpenAPIConfig; validator: Validator; builder: Builder | null; services: Services | undefined; constructor(config: OpenAPIConfig, builder: Builder | null); check(specification: OpenAPIV3.Document): boolean; updateValidator(specification: OpenAPIV3.Document): OpenAPIV3.Document<{}>; update(specification?: any): Promise<OpenAPIV3.Document<{}> | undefined>; /** * Returns the definition and * * @param {string[]} tokens * @returns {callback} The middleware */ spec(): (req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>>; registerInputValidation(): import("express-serve-static-core").Router; validateResponseMiddleware(): (req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>>; registerOutputValidation(): import("express-serve-static-core").Router; }