@nestjs/swagger
Advanced tools
Comparing version 4.0.11 to 4.1.0
@@ -11,3 +11,5 @@ "use strict"; | ||
function ApiQuery(options) { | ||
const param = Object.assign({ name: lodash_1.isNil(options.name) ? defaultQueryOptions.name : options.name, in: 'query' }, lodash_1.omit(options, 'enum')); | ||
const [type, isArray] = helpers_1.getTypeIsArrayTuple(options.type, options.isArray); | ||
const param = Object.assign(Object.assign({ name: lodash_1.isNil(options.name) ? defaultQueryOptions.name : options.name, in: 'query' }, lodash_1.omit(options, 'enum')), { type, | ||
isArray }); | ||
if (enum_utils_1.isEnumArray(options)) { | ||
@@ -14,0 +16,0 @@ enum_utils_1.addEnumArraySchema(param, options); |
import { OpenAPIObject } from './interfaces'; | ||
import { ExternalDocumentationObject, SecuritySchemeObject, ServerVariableObject } from './interfaces/open-api-spec.interface'; | ||
export declare class DocumentBuilder { | ||
private readonly logger; | ||
private readonly document; | ||
@@ -13,2 +14,3 @@ setTitle(title: string): this; | ||
setExternalDoc(description: string, url: string): this; | ||
setBasePath(path: string): this; | ||
addTag(name: string, description?: string, externalDocs?: ExternalDocumentationObject): this; | ||
@@ -15,0 +17,0 @@ addSecurity(name: string, options: SecuritySchemeObject): this; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("@nestjs/common"); | ||
const lodash_1 = require("lodash"); | ||
@@ -7,2 +8,3 @@ const document_base_1 = require("./fixtures/document.base"); | ||
constructor() { | ||
this.logger = new common_1.Logger(DocumentBuilder.name); | ||
this.document = document_base_1.buildDocumentBase(); | ||
@@ -42,2 +44,6 @@ } | ||
} | ||
setBasePath(path) { | ||
this.logger.warn('The "setBasePath" method has been deprecated. Now, a global prefix is populated automatically. If you want to ignore it, take a look here: https://docs.nestjs.com/recipes/swagger#global-prefix. Alternatively, you can use "addServer" method to set up multiple different paths.'); | ||
return this; | ||
} | ||
addTag(name, description = '', externalDocs) { | ||
@@ -44,0 +50,0 @@ this.document.tags = this.document.tags.concat(lodash_1.pickBy({ |
@@ -52,3 +52,3 @@ "use strict"; | ||
if (globalPrefix) { | ||
path = this.validateRoutePath(globalPrefix + path); | ||
path = shared_utils_1.validatePath(globalPrefix) + path; | ||
} | ||
@@ -55,0 +55,0 @@ const self = this; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const load_package_util_1 = require("@nestjs/common/utils/load-package.util"); | ||
const swagger_scanner_1 = require("./swagger-scanner"); | ||
const validate_path_util_1 = require("./utils/validate-path.util"); | ||
class SwaggerModule { | ||
@@ -21,4 +31,3 @@ static createDocument(app, config, options = {}) { | ||
const httpAdapter = app.getHttpAdapter(); | ||
const validatePath = (inputPath) => inputPath.charAt(0) !== '/' ? '/' + inputPath : inputPath; | ||
const finalPath = validatePath(path); | ||
const finalPath = validate_path_util_1.validatePath(path); | ||
const swaggerUi = load_package_util_1.loadPackage('swagger-ui-express', 'SwaggerModule', () => require('swagger-ui-express')); | ||
@@ -31,13 +40,15 @@ const swaggerHtml = swaggerUi.generateHTML(document, options); | ||
static setupFastify(path, httpServer, document) { | ||
httpServer.register(load_package_util_1.loadPackage('fastify-swagger', 'SwaggerModule', () => require('fastify-swagger')), { | ||
swagger: document, | ||
exposeRoute: true, | ||
routePrefix: path, | ||
mode: 'static', | ||
specification: { | ||
document | ||
} | ||
}); | ||
httpServer.register((httpServer) => __awaiter(this, void 0, void 0, function* () { | ||
httpServer.register(load_package_util_1.loadPackage('fastify-swagger', 'SwaggerModule', () => require('fastify-swagger')), { | ||
swagger: document, | ||
exposeRoute: true, | ||
routePrefix: path, | ||
mode: 'static', | ||
specification: { | ||
document | ||
} | ||
}); | ||
})); | ||
} | ||
} | ||
exports.SwaggerModule = SwaggerModule; |
{ | ||
"name": "@nestjs/swagger", | ||
"version": "4.0.11", | ||
"version": "4.1.0", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@swagger)", | ||
@@ -24,9 +24,11 @@ "author": "Kamil Mysliwiec", | ||
"devDependencies": { | ||
"@nestjs/common": "6.10.8", | ||
"@nestjs/core": "6.10.8", | ||
"@nestjs/platform-express": "6.10.8", | ||
"@types/jest": "24.0.23", | ||
"@nestjs/common": "6.10.12", | ||
"@nestjs/core": "6.10.12", | ||
"@nestjs/platform-express": "6.10.12", | ||
"@nestjs/platform-fastify": "6.10.12", | ||
"@types/jest": "24.0.25", | ||
"@types/lodash": "4.14.149", | ||
"@types/node": "11.15.0", | ||
"express": "4.17.1", | ||
"fastify-swagger": "2.5.0", | ||
"husky": "3.1.0", | ||
@@ -40,3 +42,3 @@ "jest": "24.9.0", | ||
"ts-jest": "24.2.0", | ||
"typescript": "3.7.3" | ||
"typescript": "3.7.4" | ||
}, | ||
@@ -43,0 +45,0 @@ "peerDependencies": { |
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
155894
170
3007
18