swagger-jsdoc
Advanced tools
Comparing version 6.0.0 to 6.0.1
#!/usr/bin/env node | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const program = require('commander'); | ||
@@ -79,2 +80,3 @@ | ||
apis: program.args, | ||
format: path.extname(output || ''), | ||
}), | ||
@@ -81,0 +83,0 @@ null, |
## Change Log | ||
### v6.0.0 (2020/12/23 09:24 +00:00) | ||
### v6.0.1 (2021/01/07 06:22 +00:00) | ||
- [#238](https://github.com/Surnet/swagger-jsdoc/pull/238) fix: yaml export format (#238) (@kalinchernev) | ||
### v6.0.0 (2020/12/23 09:38 +00:00) | ||
- [7aaa3e0](https://github.com/Surnet/swagger-jsdoc/commit/7aaa3e00b75c6deffcce09126beee391716549d2) Update TYPESCRIPT.md (@kalinchernev) | ||
- [d2965db](https://github.com/Surnet/swagger-jsdoc/commit/d2965dbf919956010bcc156e29fa086986e324e3) Release 6.0 (@kalinchernev) | ||
- [0d0be79](https://github.com/Surnet/swagger-jsdoc/commit/0d0be797263a6f95dd0efcc5386b37b8757f8ecb) Update documentation (@kalinchernev) | ||
@@ -6,0 +12,0 @@ - [6db97e2](https://github.com/Surnet/swagger-jsdoc/commit/6db97e25832e0f94f87db9c5d5340122efe4f385) update changelog (@kalinchernev) |
{ | ||
"name": "swagger-jsdoc", | ||
"description": "Generates swagger doc based on JSDoc", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">=12.0.0" |
@@ -7,2 +7,3 @@ const { build } = require('./specification'); | ||
* @param {string} options.encoding Optional, passed to readFileSync options. Defaults to 'utf8'. | ||
* @param {string} options.format Optional, defaults to '.json' - target file format '.yml' or '.yaml'. | ||
* @param {object} options.swaggerDefinition | ||
@@ -9,0 +10,0 @@ * @param {object} options.definition |
@@ -59,2 +59,13 @@ const doctrine = require('doctrine'); | ||
/** | ||
* @param {object} obj | ||
* @param {string} ext | ||
*/ | ||
function format(swaggerObject, ext) { | ||
if (ext === '.yml' || ext === '.yaml') { | ||
return YAML.stringify(swaggerObject); | ||
} | ||
return swaggerObject; | ||
} | ||
/** | ||
* OpenAPI specification validator does not accept empty values for a few properties. | ||
@@ -86,3 +97,3 @@ * Solves validator error: "Schema error should NOT have additional properties" | ||
*/ | ||
function finalize(swaggerObject) { | ||
function finalize(swaggerObject, options) { | ||
let specification = swaggerObject; | ||
@@ -100,3 +111,3 @@ | ||
return specification; | ||
return format(specification, options.format); | ||
} | ||
@@ -271,5 +282,5 @@ | ||
return finalize(specification); | ||
return finalize(specification, options); | ||
} | ||
module.exports = { prepare, build, organize, finalize }; | ||
module.exports = { prepare, build, organize, finalize, format }; |
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
68454
467