Socket
Socket
Sign inDemoInstall

@nestjs/swagger

Package Overview
Dependencies
Maintainers
3
Versions
206
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/swagger - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

5

dist/decorators/api-implicit-body.decorator.js

@@ -11,2 +11,3 @@ "use strict";

exports.ApiImplicitBody = (metadata) => {
const [type, isArray] = helpers_1.getTypeIsArrayTuple(metadata.type, metadata.isArray);
const param = {

@@ -17,6 +18,6 @@ name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name,

required: metadata.required,
type: metadata.type,
isArray: metadata.isArray
type,
isArray
};
return helpers_1.createParamDecorator(param, initialMetadata);
};

6

dist/decorators/api-response.decorator.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http_status_enum_1 = require("@nestjs/common/enums/http-status.enum");
const lodash_1 = require("lodash");
const constants_1 = require("../constants");
const http_status_enum_1 = require("@nestjs/common/enums/http-status.enum");
const helpers_1 = require("./helpers");
const initialMetadata = {

@@ -12,2 +13,5 @@ status: 0,

exports.ApiResponse = (metadata) => {
const [type, isArray] = helpers_1.getTypeIsArrayTuple(metadata.type, metadata.isArray);
metadata.type = type;
metadata.isArray = isArray;
metadata.description = metadata.description ? metadata.description : '';

@@ -14,0 +18,0 @@ const groupedMetadata = { [metadata.status]: lodash_1.omit(metadata, 'status') };

@@ -7,1 +7,2 @@ export declare const createMethodDecorator: (metakey: any, metadata: any) => MethodDecorator;

export declare const createMultipleParamDecorator: (multiMetadata: any[], initial: any) => (target: any, key: any, descriptor: PropertyDescriptor) => PropertyDescriptor;
export declare const getTypeIsArrayTuple: (input: Function | [Function], isArrayFlag: boolean) => [Function, boolean];

@@ -54,1 +54,12 @@ "use strict";

};
exports.getTypeIsArrayTuple = (input, isArrayFlag) => {
if (!input) {
return [Object, false];
}
if (isArrayFlag) {
return [input, isArrayFlag];
}
const isInputArray = lodash_1.isArray(input);
const type = isInputArray ? input[0] : input;
return [type, isInputArray];
};

@@ -182,11 +182,11 @@ "use strict";

const { type } = param;
const paramWithStringifiedType = lodash_1.pickBy(Object.assign({}, param, { type: type && shared_utils_1.isFunction(type)
const paramWithStringType = lodash_1.pickBy(Object.assign({}, param, { type: type && shared_utils_1.isFunction(type)
? exports.mapTypesToSwaggerTypes(type.name)
: exports.mapTypesToSwaggerTypes(type) }), lodash_1.negate(shared_utils_1.isUndefined));
if (paramWithStringifiedType.isArray) {
return Object.assign({}, paramWithStringifiedType, { type: 'array', items: {
type: exports.mapTypesToSwaggerTypes(param.type)
if (paramWithStringType.isArray) {
return Object.assign({}, paramWithStringType, { type: 'array', items: {
type: exports.mapTypesToSwaggerTypes(paramWithStringType.type)
} });
}
return paramWithStringifiedType;
return paramWithStringType;
});

@@ -205,2 +205,7 @@ exports.mapTypesToSwaggerTypes = (type) => {

}
const defaultTypes = [String, Boolean, Number, Object];
if (shared_utils_1.isFunction(param.type) &&
defaultTypes.some(defaultType => defaultType === param.type)) {
return param;
}
const modelName = exports.exploreModelDefinition(param.type, definitions);

@@ -207,0 +212,0 @@ const name = param.name ? param.name : modelName;

{
"name": "@nestjs/swagger",
"version": "2.3.0",
"version": "2.3.1",
"description":

@@ -5,0 +5,0 @@ "Nest - modern, fast, powerful node.js web framework (@swagger)",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc