UNPKG

@ivamuno/nestjs-openapi

Version:
19 lines (18 loc) 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AsyncApiModule = void 0; const redoc_module_1 = require("../redoc/redoc.module"); const asyncapi_scanner_1 = require("./asyncapi.scanner"); class AsyncApiModule { static createDocument(app, config, options = {}) { const swaggerScanner = new asyncapi_scanner_1.AsyncapiScanner(); const document = swaggerScanner.scanApplication(app, options); document.components = Object.assign(Object.assign({}, (config.components || {})), document.components); return Object.assign(Object.assign({ asyncapi: '2.0.0' }, config), document); } static setup(path, app, document, options) { const defaultOptions = { docName: 'asyncapi', title: 'AsyncApi documentation' }; redoc_module_1.RedocModule.setup(path, app, document, Object.assign(Object.assign({}, defaultOptions), options)); } } exports.AsyncApiModule = AsyncApiModule;