@nestjs/swagger
Advanced tools
Comparing version 6.0.3 to 6.0.4
@@ -30,3 +30,3 @@ "use strict"; | ||
} | ||
static serveDocuments(finalPath, httpAdapter, swaggerInitJS, yamlDocument, jsonDocument, html) { | ||
static serveDocuments(finalPath, urlLastSubdirectory, httpAdapter, swaggerInitJS, yamlDocument, jsonDocument, html) { | ||
httpAdapter.get(`${finalPath}/swagger-ui-init.js`, (req, res) => { | ||
@@ -36,2 +36,6 @@ res.type('application/javascript'); | ||
}); | ||
httpAdapter.get(`${finalPath}/${urlLastSubdirectory}/swagger-ui-init.js`, (req, res) => { | ||
res.type('application/javascript'); | ||
res.send(swaggerInitJS); | ||
}); | ||
httpAdapter.get(finalPath, (req, res) => { | ||
@@ -63,11 +67,13 @@ res.type('text/html'); | ||
: path); | ||
const yamlDocument = jsyaml.dump(document); | ||
const urlLastSubdirectory = finalPath.split('/').slice(-1).pop(); | ||
const yamlDocument = jsyaml.dump(document, { skipInvalid: true }); | ||
const jsonDocument = JSON.stringify(document); | ||
const html = (0, swagger_ui_1.buildSwaggerHTML)(finalPath, document, options); | ||
const html = (0, swagger_ui_1.buildSwaggerHTML)(urlLastSubdirectory, document, options); | ||
const swaggerInitJS = (0, swagger_ui_1.buildSwaggerInitJS)(document, options); | ||
const httpAdapter = app.getHttpAdapter(); | ||
SwaggerModule.serveDocuments(finalPath, httpAdapter, swaggerInitJS, yamlDocument, jsonDocument, html); | ||
SwaggerModule.serveDocuments(finalPath, urlLastSubdirectory, httpAdapter, swaggerInitJS, yamlDocument, jsonDocument, html); | ||
SwaggerModule.serveStatic(finalPath, app); | ||
SwaggerModule.serveStatic(`${finalPath}/${urlLastSubdirectory}`, app); | ||
} | ||
} | ||
exports.SwaggerModule = SwaggerModule; |
@@ -8,3 +8,3 @@ "use strict"; | ||
function buildSwaggerInitJS(swaggerDoc, customOptions = {}) { | ||
const { swaggerOptions, swaggerUrl } = customOptions; | ||
const { swaggerOptions = {}, swaggerUrl } = customOptions; | ||
const swaggerInitOptions = { | ||
@@ -11,0 +11,0 @@ swaggerDoc, |
{ | ||
"name": "@nestjs/swagger", | ||
"version": "6.0.3", | ||
"version": "6.0.4", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@swagger)", | ||
@@ -37,7 +37,7 @@ "author": "Kamil Mysliwiec", | ||
"@fastify/static": "6.4.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", | ||
"@nestjs/common": "9.0.3", | ||
"@nestjs/core": "9.0.3", | ||
"@nestjs/platform-express": "9.0.3", | ||
"@nestjs/platform-fastify": "9.0.3", | ||
"@types/jest": "28.1.5", | ||
"@types/js-yaml": "4.0.5", | ||
@@ -55,3 +55,3 @@ "@types/lodash": "4.14.182", | ||
"husky": "8.0.1", | ||
"jest": "28.1.2", | ||
"jest": "28.1.3", | ||
"lint-staged": "13.0.3", | ||
@@ -58,0 +58,0 @@ "openapi-types": "12.0.0", |
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
271238
5477