@marxlnfcs/nest-swagger-decorators
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -7,8 +7,9 @@ "use strict"; | ||
const property_decorator_1 = require("./property.decorator"); | ||
const swagger_1 = require("@nestjs/swagger"); | ||
function ApiClassProperty(classRef, descriptionOrOptions, opts) { | ||
const [description, options] = [(0, utils_1.extractString)(descriptionOrOptions, opts === null || opts === void 0 ? void 0 : opts.description), (0, utils_1.extractOptions)(descriptionOrOptions, opts) || {}]; | ||
const models = (0, utils_1.extractClassRef)(classRef); | ||
return (0, common_1.applyDecorators)((0, property_decorator_1.ApiProperty)(description, Object.assign(options, { | ||
type: models | ||
}))); | ||
return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(...Array.isArray(models) ? models : [models]), (0, property_decorator_1.ApiProperty)(description, Object.assign(options, !Array.isArray(models) | ||
? { $ref: (0, utils_1.getExtraModelReference)(models) } | ||
: { type: 'array', items: { $ref: (0, utils_1.getExtraModelReference)(models[0]) } }))); | ||
} | ||
@@ -19,7 +20,7 @@ exports.ApiClassProperty = ApiClassProperty; | ||
const models = (0, utils_1.extractClassRef)(classRef); | ||
return (0, common_1.applyDecorators)((0, property_decorator_1.ApiPropertyOptional)(description, Object.assign(options, { | ||
type: models | ||
}))); | ||
return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(...Array.isArray(models) ? models : [models]), (0, property_decorator_1.ApiPropertyOptional)(description, Object.assign(options, !Array.isArray(models) | ||
? { $ref: (0, utils_1.getExtraModelReference)(models) } | ||
: { type: 'array', items: { $ref: (0, utils_1.getExtraModelReference)(models[0]) } }))); | ||
} | ||
exports.ApiClassPropertyOptional = ApiClassPropertyOptional; | ||
//# sourceMappingURL=class-property.decorator.js.map |
{ | ||
"name": "@marxlnfcs/nest-swagger-decorators", | ||
"private": false, | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Extended decorators for the @nestjs/swagger module", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
219237
1242