UNPKG

1.18 kBTypeScriptView Raw
1/// <reference types="handlebars" />
2export interface SwaggerMetadataMiddlewareConfig {
3 swaggerFilePath: string;
4 apiKey: string;
5 swagger?: any;
6 logger?: Logger;
7}
8export default class SwaggerMetadataMiddleware {
9 swagger: object;
10 swaggerFile: string;
11 logger: any;
12 private apiKey;
13 /**
14 * Creates an instance of the Inceptum Swagger middleware.
15 * This middleware injects into each request the metadata that is appropriate for this request
16 * from the swagger file. Also, it will parse the parameters and body of the request.
17 * It will NOT validate the request or the response.
18 * @param object config The configuration to use for this Middleware instance
19 * @param [any] config.swagger If provided, this is the swagger loaded as an object
20 * @param [string] config.swaggerFilePath Required if config.swagger is not passed directly.
21 * The location of the swagger yaml file
22 */
23 constructor(config: SwaggerMetadataMiddlewareConfig);
24 loadSwagger(config: any): void;
25 jwtHandler(req: any, authOrSecDef: any, scopesOrApiKey: any, callback: any): any;
26 register(expressApp: any): Promise<void>;
27}