swagger-generator-koa
Version:
Generate automatic swagger using joi validation.
43 lines (42 loc) • 1.55 kB
TypeScript
import { swaggerize } from 'swagger-spec-express';
import Validation from './validation/validate';
declare const _default: {
swaggerize: typeof swaggerize;
createModel: typeof createModel;
serveSwagger: typeof serveSwagger;
describeSwaggerWithoutPath: typeof describeSwaggerWithoutPath;
validation: typeof Validation;
};
/**
* This module will support all the functionality of swagger-spec-express with additonal
* functions of this module.
* This module uses swagger-spec-express, swagger-ui-express and joi-to-swagger modules to
* generate swagger documentation with joi validation.
*/
export = _default;
/**
* Serve swagger.
* @param {*} app express object.
* @param {*} endPoint swagger end point.
* @param {*} options swagger options.
*/
declare function serveSwagger(app: any, endPoint: string, options: object, path: {
routePath?: string;
requestModelPath: string;
responseModelPath: string;
}): void;
/**
* This function will create proper schema based on given body, query, header and path parameter
* mentioned in the schema.
* @param {object} schema this is schema mentioned for each API in a route.
*/
declare function createModel(schema: any, responseModel: {
[x: string]: any;
hasOwnProperty: (arg0: string) => void;
}): any;
/**
* @param app : Koa object
* @param requestModelPath : request model path
* @param responseModelPath : responsemodel model path.
*/
declare function describeSwaggerWithoutPath(app: any, requestModelPath: string, responseModelPath: string): void;