Socket
Socket
Sign inDemoInstall

swagger2openapi

Package Overview
Dependencies
47
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.3 to 7.0.0

18

boast.js

@@ -10,4 +10,3 @@ #!/usr/bin/env node

const yaml = require('yaml');
const fetch = require('node-fetch-h2');
const bae = require('better-ajv-errors');
const fetch = require('node-fetch');

@@ -25,5 +24,2 @@ const swagger2openapi = require('./index.js');

.describe('all','show all lint warnings')
.boolean('bae')
.alias('b','bae')
.describe('bae','enable better-ajv-errors')
.string('encoding')

@@ -75,7 +71,5 @@ .alias('e','encoding')

argv.laxurls = true;
argv.laxDefaults = true;
argv.fetch = fetch;
if (argv.all) argv.lintLimit = Number.MAX_SAFE_INTEGER;
if (argv.bae) {
argv.validateSchema = 'first';
argv.prettify = true;
}
if (argv.internal) {

@@ -119,7 +113,3 @@ argv.resolveInternal = true;

for (let warning of options.warnings) {
if (argv.bae) {
const display = bae(options.schema,options.openapi,[warning]);
console.warn(display);
}
else if (options.json) {
if (options.json) {
jsonOutput.warnings.push({ message:warning.message, pointer:warning.pointer, ruleName:warning.ruleName, ruleUrl:warning.rule.url });

@@ -126,0 +116,0 @@ }

@@ -52,5 +52,2 @@ #!/usr/bin/env node

.describe('output', 'output conversion result')
.boolean('prettify')
.alias('p','prettify')
.describe('prettify','pretty schema validation errors')
.boolean('quiet')

@@ -92,4 +89,2 @@ .alias('q', 'quiet')

let genStack = [];
let options = argv;

@@ -114,3 +109,3 @@ options.patch = !argv.nopatch;

}
else if (err.stack && err.name !== 'AssertionError' && err.name !== 'CLIError') {
else if (err.stack && err.name !== 'AssertionError') {
console.warn(err.stack);

@@ -154,3 +149,2 @@ warnings.push(err.name+' '+options.file);

}
genStackNext();
}

@@ -202,3 +196,3 @@

console.warn(common.colour.red + (options.context.length ? options.context.pop() : 'No context')+ '\n' + ex.message);
if (ex.stack && ex.name !== 'AssertionError' && ex.name !== 'CLIError') {
if (ex.stack && ex.name !== 'AssertionError') {
console.warn(ex.stack);

@@ -211,10 +205,3 @@ }

function genStackNext() {
if (!genStack.length) return false;
let gen = genStack.shift();
gen.next();
return true;
}
function* check(file, force, expectFailure) {
async function check(file, force, expectFailure) {
let result = false;

@@ -251,3 +238,2 @@ options.context = [];

if (!src || ((!src.swagger && !src.openapi))) {
genStackNext();
return true;

@@ -288,3 +274,2 @@ }

}
genStackNext();
result = false;

@@ -308,3 +293,2 @@ });

}
genStackNext();
result = false;

@@ -315,3 +299,2 @@ });

else {
genStackNext();
result = true;

@@ -322,3 +305,3 @@ }

function processPathSpec(pathspec, expectFailure) {
async function processPathSpec(pathspec, expectFailure) {
globalExpectFailure = expectFailure;

@@ -329,13 +312,10 @@ if (pathspec.startsWith('@')) {

for (let file of list) {
genStack.push(check(file, false, expectFailure));
await check(file, false, expectFailure);
}
genStackNext();
}
else if (pathspec.startsWith('http')) {
genStack.push(check(pathspec, true, expectFailure));
genStackNext();
await check(pathspec, true, expectFailure);
}
else if (fs.statSync(path.resolve(pathspec)).isFile()) {
genStack.push(check(pathspec, true, expectFailure));
genStackNext();
await check(pathspec, true, expectFailure);
}

@@ -346,8 +326,7 @@ else {

})
.then(files => {
.then(async function(files) {
files = files.sort();
for (let file of files) {
genStack.push(check(file, false, expectFailure));
await check(file, false, expectFailure);
}
genStackNext();
})

@@ -360,14 +339,18 @@ .catch(err => {

process.exitCode = 1;
console.warn('Gathering...');
for (let pathspec of argv._) {
processPathSpec(pathspec, false);
}
if (argv.fail) {
async function main() {
process.exitCode = 1;
console.warn('Gathering...');
for (let pathspec of argv._) {
await processPathSpec(pathspec, false);
}
if (argv.fail) {
if (!Array.isArray(argv.fail)) argv.fail = [argv.fail];
for (let pathspec of argv.fail) {
processPathSpec(pathspec, true);
await processPathSpec(pathspec, true);
}
}
}
main();
process.on('unhandledRejection', r => console.warn('UPR',r));

@@ -374,0 +357,0 @@

{
"name": "swagger2openapi",
"version": "6.2.3",
"version": "7.0.0",
"description": "Convert Swagger 2.0 definitions to OpenApi 3.0 and validate",

@@ -37,3 +37,2 @@ "main": "index.js",

"dependencies": {
"better-ajv-errors": "^0.6.1",
"call-me-maybe": "^1.0.1",

@@ -43,7 +42,7 @@ "node-fetch-h2": "^2.3.0",

"oas-kit-common": "^1.0.8",
"oas-resolver": "^2.4.3",
"oas-resolver": "^2.4.4",
"oas-schema-walker": "^1.1.5",
"oas-validator": "^4.0.8",
"reftools": "^1.1.5",
"yaml": "^1.8.3",
"oas-validator": "^5.0.0",
"reftools": "^1.1.6",
"yaml": "^1.10.0",
"yargs": "^15.3.1"

@@ -64,3 +63,3 @@ },

],
"gitHead": "63c5ebae86e751955e35b56262353a0429900d8a"
"gitHead": "d4c6b903ab3ef4a94ac3fd8a2b92eaf76b9b7fb6"
}

@@ -75,3 +75,3 @@ # swagger2openapi

See the [boast command-line tool](./boast.js) for a fuller CLI tool for converting, validating and linting.
See the [boast command-line tool](/packages/swagger2openapi/boast.js) for a fuller CLI tool for converting, validating and linting.

@@ -78,0 +78,0 @@ See here for complete [documentation](/docs/options.md) of the `options` object.

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc