swagger-jsdoc
Advanced tools
Comparing version 6.2.0 to 6.2.1
{ | ||
"name": "swagger-jsdoc", | ||
"description": "Generates swagger doc based on JSDoc", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">=12.0.0" |
@@ -72,2 +72,3 @@ # swagger-jsdoc | ||
- Swagger 2 | ||
- AsyncAPI 2.0 | ||
@@ -74,0 +75,0 @@ ## Documentation |
@@ -21,3 +21,2 @@ const doctrine = require('doctrine'); | ||
function prepare(definition) { | ||
let version; | ||
const swaggerObject = JSON.parse(JSON.stringify(definition)); | ||
@@ -39,15 +38,25 @@ const specificationTemplate = { | ||
'components', | ||
'channels', | ||
], | ||
v4: ['components', 'channels'], | ||
}; | ||
if (swaggerObject.openapi) { | ||
version = 'v3'; | ||
} else if (swaggerObject.swagger) { | ||
version = 'v2'; | ||
} else { | ||
version = 'v2'; | ||
const getVersion = () => { | ||
if (swaggerObject.asyncapi) { | ||
return 'v4'; | ||
} | ||
if (swaggerObject.openapi) { | ||
return 'v3'; | ||
} | ||
if (swaggerObject.swagger) { | ||
return 'v2'; | ||
} | ||
swaggerObject.swagger = '2.0'; | ||
} | ||
return 'v2'; | ||
}; | ||
const version = getVersion(); | ||
specificationTemplate[version].forEach((property) => { | ||
@@ -54,0 +63,0 @@ swaggerObject[property] = swaggerObject[property] || {}; |
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
72246
518
81