@nestjs/swagger
Advanced tools
Comparing version 6.0.1 to 6.0.2
import { INestApplication } from '@nestjs/common'; | ||
import { OpenAPIObject, SwaggerDocumentOptions, SwaggerCustomOptions } from './interfaces'; | ||
import { OpenAPIObject, SwaggerCustomOptions, SwaggerDocumentOptions } from './interfaces'; | ||
export declare class SwaggerModule { | ||
@@ -4,0 +4,0 @@ static createDocument(app: INestApplication, config: Omit<OpenAPIObject, 'paths'>, options?: SwaggerDocumentOptions): OpenAPIObject; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SwaggerModule = void 0; | ||
const jsyaml = require("js-yaml"); | ||
const swagger_scanner_1 = require("./swagger-scanner"); | ||
const swagger_ui_1 = require("./swagger-ui"); | ||
const assign_two_levels_deep_1 = require("./utils/assign-two-levels-deep"); | ||
const get_global_prefix_1 = require("./utils/get-global-prefix"); | ||
const validate_path_util_1 = require("./utils/validate-path.util"); | ||
const jsyaml = require("js-yaml"); | ||
const swagger_ui_1 = require("./swagger-ui"); | ||
class SwaggerModule { | ||
@@ -39,8 +39,12 @@ static createDocument(app, config, options = {}) { | ||
}); | ||
httpAdapter.get(finalPath + '/', (req, res) => { | ||
res.type('text/html'); | ||
res.send(html); | ||
}); | ||
try { | ||
httpAdapter.get(finalPath + '/', (req, res) => { | ||
res.type('text/html'); | ||
res.send(html); | ||
}); | ||
} | ||
catch (err) { | ||
} | ||
httpAdapter.get(`${finalPath}-json`, (req, res) => { | ||
res.type('text/json'); | ||
res.type('application/json'); | ||
res.send(jsonDocument); | ||
@@ -60,3 +64,3 @@ }); | ||
const jsonDocument = JSON.stringify(document); | ||
const html = (0, swagger_ui_1.buildSwaggerHTML)(finalPath, document, options); | ||
const html = (0, swagger_ui_1.buildSwaggerHTML)(`.${finalPath}`, document, options); | ||
const swaggerInitJS = (0, swagger_ui_1.buildSwaggerInitJS)(document, options); | ||
@@ -63,0 +67,0 @@ const httpAdapter = app.getHttpAdapter(); |
@@ -14,5 +14,5 @@ "use strict"; | ||
}, 2); | ||
json = json.replace(new RegExp(functionPlaceholder, 'g'), () => fns.shift()); | ||
json = json.replace(new RegExp('"' + functionPlaceholder + '"', 'g'), () => fns.shift()); | ||
return `let options = ${json};`; | ||
} | ||
exports.buildJSInitOptions = buildJSInitOptions; |
{ | ||
"name": "@nestjs/swagger", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@swagger)", | ||
@@ -37,6 +37,6 @@ "author": "Kamil Mysliwiec", | ||
"@fastify/static": "6.4.0", | ||
"@nestjs/common": "9.0.0", | ||
"@nestjs/core": "9.0.0", | ||
"@nestjs/platform-express": "9.0.0", | ||
"@nestjs/platform-fastify": "9.0.0", | ||
"@nestjs/common": "9.0.2", | ||
"@nestjs/core": "9.0.2", | ||
"@nestjs/platform-express": "9.0.2", | ||
"@nestjs/platform-fastify": "9.0.2", | ||
"@types/jest": "28.1.4", | ||
@@ -61,2 +61,3 @@ "@types/js-yaml": "4.0.5", | ||
"release-it": "15.1.1", | ||
"supertest": "^6.2.4", | ||
"swagger-parser": "10.0.3", | ||
@@ -63,0 +64,0 @@ "ts-jest": "28.0.5", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270817
5471
30