swagger2openapi
Advanced tools
Comparing version 4.0.0 to 4.0.1
33
boast.js
@@ -11,2 +11,3 @@ #!/usr/bin/env node | ||
const fetch = require('node-fetch-h2'); | ||
const bae = require('better-ajv-errors'); | ||
@@ -19,2 +20,5 @@ const swagger2openapi = require('./index.js'); | ||
let argv = require('yargs') | ||
.boolean('bae') | ||
.alias('b','bae') | ||
.describe('bae','enable better-ajv-errors') | ||
.boolean('lint') | ||
@@ -41,2 +45,6 @@ .describe('lint','also lint the document') | ||
argv.source = argv._[0]; | ||
if (argv.bae) { | ||
argv.validateSchema = 'first'; | ||
argv.prettify = true; | ||
} | ||
let options; | ||
@@ -54,3 +62,3 @@ if (argv.source.startsWith('http')) { | ||
catch (ex) { | ||
console.warn(ex); | ||
console.warn(ex.message); | ||
if (options.verbose > 1) console.warn(ex.stack); | ||
@@ -61,10 +69,23 @@ if (options.context) { | ||
} | ||
if (options.warnings) { | ||
for (let warning of options.warnings) { | ||
if (argv.bae) { | ||
const display = bae(options.schema,options.openapi,[warning]); | ||
console.warn(display); | ||
} | ||
else { | ||
console.warn(warning.message,warning.pointer); | ||
} | ||
} | ||
} | ||
reject(ex); | ||
} | ||
if (options.sourceYaml) { | ||
console.log(yaml.safeDump(options.openapi)); | ||
if (result) { | ||
if (options.sourceYaml) { | ||
console.log(yaml.safeDump(options.openapi)); | ||
} | ||
else { | ||
console.log(JSON.stringify(options.openapi,null,2)); | ||
} | ||
} | ||
else { | ||
console.log(JSON.stringify(options.openapi,null,2)); | ||
} | ||
resolve(options.openapi); | ||
@@ -71,0 +92,0 @@ }); |
@@ -488,3 +488,2 @@ // @ts-check | ||
if (typeof param['x-deprecated'] === 'boolean') { | ||
@@ -512,3 +511,6 @@ param.deprecated = param['x-deprecated']; | ||
} | ||
originalType = param.type; | ||
if (param.type === 'file') { | ||
param['x-s2o-originalType'] = param.type; | ||
originalType = param.type; | ||
} | ||
if (param.description && typeof param.description === 'object' && param.description.$ref) { | ||
@@ -644,3 +646,3 @@ // $ref anywhere sensibility | ||
} | ||
if (originalType === 'file') { | ||
if ((originalType === 'file') || (param['x-s2o-originalType'] === 'file')) { | ||
target.type = 'string'; | ||
@@ -647,0 +649,0 @@ target.format = 'binary'; |
{ | ||
"name": "swagger2openapi", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Convert Swagger 2.0 definitions to OpenApi 3.0 and validate", | ||
@@ -9,3 +9,4 @@ "main": "index.js", | ||
"oas-validate": "./oas-validate.js", | ||
"oas-resolve": "./oas-resolve.js" | ||
"oas-resolve": "./oas-resolve.js", | ||
"boast": "./boast.js" | ||
}, | ||
@@ -37,2 +38,3 @@ "scripts": { | ||
"dependencies": { | ||
"better-ajv-errors": "^0.6.1", | ||
"call-me-maybe": "^1.0.1", | ||
@@ -42,6 +44,6 @@ "js-yaml": "^3.12.0", | ||
"node-readfiles": "^0.2.0", | ||
"oas-kit-common": "^1.0.5", | ||
"oas-resolver": "^1.1.0", | ||
"oas-schema-walker": "^1.1.1", | ||
"oas-validator": "^2.0.0", | ||
"oas-kit-common": "^1.0.6", | ||
"oas-resolver": "^1.1.1", | ||
"oas-schema-walker": "^1.1.2", | ||
"oas-validator": "^2.0.1", | ||
"reftools": "^1.0.4", | ||
@@ -63,3 +65,3 @@ "yargs": "^12.0.2" | ||
], | ||
"gitHead": "81067168e0cc0c151de4fd25bf24cfc23bc7bf8b" | ||
"gitHead": "50a250ff1e68b735925e06e59ba9aed12207216c" | ||
} |
@@ -65,2 +65,4 @@ # swagger2openapi | ||
See the [boast command-line tool](./boast.js) for a fuller example of converting, validating and linting. | ||
See here for complete [documentation](/docs/options.md) of the `options` object. | ||
@@ -67,0 +69,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
97743
10
2044
146
11
+ Addedbetter-ajv-errors@^0.6.1
+ Addedajv@6.12.6(transitive)
+ Addedbetter-ajv-errors@0.6.7(transitive)
+ Addedcore-js@3.38.1(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedleven@3.1.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addeduri-js@4.4.1(transitive)
Updatedoas-kit-common@^1.0.6
Updatedoas-resolver@^1.1.1
Updatedoas-schema-walker@^1.1.2
Updatedoas-validator@^2.0.1