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 1.1.15 to 1.1.16

2

package.json
{
"name": "swagger2openapi",
"version": "1.1.15",
"version": "1.1.16",
"description": "Convert Swagger 2.0 specifications to OpenApi 3.0",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ # swagger2openapi

![Build](https://img.shields.io/travis/Mermade/swagger2openapi.svg) [![Tested on APIs.guru](https://api.apis.guru/badges/tested_on.svg)](https://APIs.guru) [![Tested on Mermade OpenAPIs](https://mermade.github.io/openapi_optimise/tested.svg)](https://github.com/mermade/openapi_specifications)
![Build](https://img.shields.io/travis/Mermade/swagger2openapi.svg) [![Tested on APIs.guru](https://api.apis.guru/badges/tested_on.svg)](https://APIs.guru) [![Tested on Mermade OpenAPIs](https://img.shields.io/badge/Additional%20Specs-1258-brightgreen.svg)](https://github.com/mermade/openapi_specifications)
[![Known Vulnerabilities](https://snyk.io/test/npm/swagger2openapi/badge.svg)](https://snyk.io/test/npm/swagger2openapi)

@@ -8,0 +8,0 @@

@@ -68,7 +68,7 @@ 'use strict';

console.log(green+' %s %s',src.info.title,src.info.version);
console.log(' %s',src.swagger ? src.host : (src.servers && src.servers.length ? src.servers[0].url : ''));
console.log(' %s',src.swagger ? (src.host ? src.host : 'relative') : (src.servers && src.servers.length ? src.servers[0].url : 'relative'));
result = true;
}
catch (ex) {
console.log(ex.message);
console.log(red+options.context.pop()+'\n'+ex.message);
result = false;

@@ -110,4 +110,3 @@ }

failures.sort();
console.log(red);
console.log('Failures:');
console.log(normal+'\nFailures:'+red);
for (var f in failures) {

@@ -114,0 +113,0 @@ console.log(failures[f]);

@@ -16,2 +16,6 @@ var url = require('url');

function contextAppend(options,s) {
options.context.push(options.context[options.context.length-1]+'/'+s);
}
function checkServers(servers) {

@@ -30,3 +34,4 @@ for (var server of servers) {

function checkParam(param,openapi,options){
function checkParam(param,index,openapi,options){
contextAppend(options,index);
if (param.$ref) {

@@ -47,2 +52,3 @@ param = jptr.jptr(openapi,param.$ref);

param.in.should.not.be.exactly('formData','Parameter type formData is no-longer valid');
options.context.pop();
return true;

@@ -53,6 +59,7 @@ }

for (var o in pathItem) {
contextAppend(options,o);
var op = pathItem[o];
if (o == 'parameters') {
for (var param of pathItem.parameters) {
checkParam(param,openapi,options);
for (var p in pathItem.parameters) {
checkParam(pathItem.parameters[p],p,openapi,options);
}

@@ -79,5 +86,7 @@ }

if (op.parameters) {
for (var param of op.parameters) {
checkParam(param,openapi,options);
contextAppend(options,'parameters');
for (var p in op.parameters) {
checkParam(op.parameters[p],p,openapi,options);
}
options.context.pop();
}

@@ -92,2 +101,3 @@ if (op.externalDocs) {

}
options.context.pop();
}

@@ -97,2 +107,4 @@ }

function validate(openapi, options) {
options.context = [];
options.context.push('#/');
openapi.should.not.have.key('swagger');

@@ -133,2 +145,3 @@ openapi.should.have.key('openapi');

for (var s in openapi.components.securitySchemes) {
options.context.push('#/components/securitySchemes/'+s);
var scheme = openapi.components.securitySchemes[s];

@@ -190,2 +203,3 @@ scheme.should.have.property('type');

}
options.context.pop();
}

@@ -204,3 +218,5 @@ }

for (var p in openapi.components.parameters) {
checkParam(openapi.components.parameters[p],openapi,options);
options.context.push('#/components/parameters/'+p);
checkParam(openapi.components.parameters[p],p,openapi,options);
options.context.pop();
}

@@ -210,3 +226,5 @@ }

if (options.verbose) console.log(p);
options.context.push('#/paths/'+jptr.jpescape(p));
checkPathItem(openapi.paths[p],openapi,options);
options.context.pop();
}

@@ -216,3 +234,5 @@ if (openapi["x-ms-paths"]) {

if (options.verbose) console.log(p);
options.context.push('#/x-ms-paths/'+jptr.jpescape(p));
checkPathItem(openapi["x-ms-paths"][p],openapi,options);
options.context.pop();
}

@@ -219,0 +239,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