Socket
Socket
Sign inDemoInstall

swagger2openapi

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger2openapi - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

Dockerfile

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 @@ });

8

index.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc