@nestjs/swagger
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -13,2 +13,3 @@ export declare const DECORATORS_PREFIX = "swagger"; | ||
API_OAUTH2: string; | ||
API_EXCLUDE_ENDPOINT: string; | ||
}; |
@@ -15,2 +15,3 @@ "use strict"; | ||
API_OAUTH2: `${exports.DECORATORS_PREFIX}/apiOauth2`, | ||
API_EXCLUDE_ENDPOINT: `${exports.DECORATORS_PREFIX}/apiExcludeEndpoint` | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = require("lodash"); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
@@ -6,0 +6,0 @@ name: '', |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = require("lodash"); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
@@ -6,0 +6,0 @@ name: '', |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = require("lodash"); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
@@ -6,0 +6,0 @@ name: '', |
@@ -5,2 +5,3 @@ export declare const ApiOperation: (metadata: { | ||
operationId?: string; | ||
deprecated?: boolean; | ||
}) => MethodDecorator; |
@@ -12,3 +12,3 @@ "use strict"; | ||
? initialMetadata.summary | ||
: metadata.title, description: metadata.description, operationId: metadata.operationId }), lodash_1.negate(lodash_1.isUndefined))); | ||
: metadata.title, description: metadata.description, operationId: metadata.operationId, deprecated: metadata.deprecated }), lodash_1.negate(lodash_1.isUndefined))); | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = require("lodash"); | ||
const constants_1 = require("../constants"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
@@ -6,0 +6,0 @@ status: 0, |
@@ -13,1 +13,2 @@ export * from './api-operation.decorator'; | ||
export * from './api-oauth2.decorator'; | ||
export * from './api-exclude-endpoint.decorator'; |
@@ -18,1 +18,2 @@ "use strict"; | ||
__export(require("./api-oauth2.decorator")); | ||
__export(require("./api-exclude-endpoint.decorator")); |
@@ -94,3 +94,3 @@ "use strict"; | ||
} | ||
return { name: key, $ref }; | ||
return { name: key, $ref, required: metadata.required }; | ||
} | ||
@@ -97,0 +97,0 @@ const metatype = metadata.type && shared_utils_1.isFunction(metadata.type) |
@@ -34,2 +34,10 @@ "use strict"; | ||
const swaggerType = api_parameters_explorer_1.mapTypesToSwaggerTypes(metatype); | ||
if (isArray) { | ||
return Object.assign({}, response, { schema: { | ||
type: 'array', | ||
items: { | ||
type: swaggerType | ||
} | ||
} }); | ||
} | ||
return Object.assign({}, response, { schema: { | ||
@@ -36,0 +44,0 @@ type: swaggerType |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("@nestjs/common"); | ||
const constants_1 = require("@nestjs/common/constants"); | ||
const shared_utils_1 = require("@nestjs/common/utils/shared.utils"); | ||
const metadata_scanner_1 = require("@nestjs/core/metadata-scanner"); | ||
const lodash_1 = require("lodash"); | ||
const pathToRegexp = require("path-to-regexp"); | ||
const api_consumes_explorer_1 = require("./explorers/api-consumes.explorer"); | ||
const api_exclude_endpoint_explorer_1 = require("./explorers/api-exclude-endpoint.explorer"); | ||
const api_operation_explorer_1 = require("./explorers/api-operation.explorer"); | ||
const api_parameters_explorer_1 = require("./explorers/api-parameters.explorer"); | ||
const api_produces_explorer_1 = require("./explorers/api-produces.explorer"); | ||
@@ -9,8 +17,2 @@ const api_response_explorer_1 = require("./explorers/api-response.explorer"); | ||
const api_use_tags_explorer_1 = require("./explorers/api-use-tags.explorer"); | ||
const lodash_1 = require("lodash"); | ||
const shared_utils_1 = require("@nestjs/common/utils/shared.utils"); | ||
const metadata_scanner_1 = require("@nestjs/core/metadata-scanner"); | ||
const common_1 = require("@nestjs/common"); | ||
const api_operation_explorer_1 = require("./explorers/api-operation.explorer"); | ||
const api_parameters_explorer_1 = require("./explorers/api-parameters.explorer"); | ||
class SwaggerExplorer { | ||
@@ -46,2 +48,6 @@ constructor() { | ||
const targetCallback = prototype[name]; | ||
const excludeEndpoint = api_exclude_endpoint_explorer_1.exploreApiExcludeEndpointMetadata(instance, prototype, targetCallback); | ||
if (excludeEndpoint && excludeEndpoint.disable) { | ||
return; | ||
} | ||
const methodMetadata = lodash_1.mapValues(explorersSchema, (explorers) => explorers.reduce((metadata, fn) => { | ||
@@ -99,6 +105,11 @@ const exploredMetadata = fn.call(self, instance, prototype, targetCallback, path); | ||
} | ||
const pathWithParams = path.replace(/([:].*?[^\/]*)/g, str => { | ||
str = str.replace(/\(.*\)$/, ''); | ||
return `{${str.slice(1, str.length)}}`; | ||
}); | ||
let pathWithParams = ''; | ||
for (const item of pathToRegexp.parse(path)) { | ||
if (shared_utils_1.isString(item)) { | ||
pathWithParams += item; | ||
} | ||
else { | ||
pathWithParams += `${item.prefix}{${item.name}}`; | ||
} | ||
} | ||
return pathWithParams === '/' ? '' : shared_utils_1.validatePath(pathWithParams); | ||
@@ -105,0 +116,0 @@ } |
{ | ||
"name": "@nestjs/swagger", | ||
"version": "2.0.2", | ||
"description": | ||
"Nest - modern, fast, powerful node.js web framework (@swagger)", | ||
"version": "2.1.0", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@swagger)", | ||
"author": "Kamil Mysliwiec", | ||
@@ -19,5 +18,8 @@ "license": "MIT", | ||
"lodash": "^4.17.4", | ||
"path-to-regexp": "^2.2.1", | ||
"swagger-ui-express": "^3.0.8" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/common": "^5.0.0", | ||
"@nestjs/core": "^5.0.0", | ||
"husky": "^0.14.3", | ||
@@ -24,0 +26,0 @@ "lint-staged": "^7.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
67652
81
1189
5
6
+ Addedpath-to-regexp@^2.2.1
+ Addedpath-to-regexp@2.4.0(transitive)