swagger2openapi
Advanced tools
Comparing version 2.12.0-0 to 2.12.0-1
{ | ||
"name": "swagger2openapi", | ||
"version": "2.12.0-0", | ||
"version": "2.12.0-1", | ||
"description": "Convert Swagger 2.0 definitions to OpenApi 3.0 and validate", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,2 +36,5 @@ 'use strict'; | ||
function resolveAllInternal(obj, context, src, parentPath, base, options) { | ||
let attachPoint = options.externalRefs[src+parentPath].paths[0]; | ||
let baseUrl = url.parse(base); | ||
@@ -45,3 +48,3 @@ let seen = {}; // seen is indexed by the $ref value and contains path replacements | ||
if (obj[key].startsWith('#')) { | ||
if (!seen[obj[key]]) { | ||
if (!seen[obj[key]] && !obj.$fixed) { | ||
let target = common.clone(jptr(context, obj[key])); | ||
@@ -66,3 +69,3 @@ if (options.verbose>1) console.log((target === false ? red : green)+'Internal resolution', obj[key], state.depth, normal); | ||
if (!obj.$fixed) { | ||
let newRef = (parentPath+(seen[obj[key]].replace('#/','/'))); | ||
let newRef = (attachPoint+'/'+seen[obj[key]]).split('/#/').join('/'); | ||
state.parent[state.pkey] = { $ref: newRef, $fixed: true }; | ||
@@ -87,2 +90,9 @@ if (options.verbose>1) console.log('Replacing with',newRef); | ||
} | ||
common.recurse(obj,{},function(obj,key,state){ | ||
if (common.isRef(obj, key)) { | ||
if (obj.$fixed) delete obj.$fixed; | ||
}; | ||
}); | ||
if (options.verbose>1) console.log('Finished internal resolution'); | ||
@@ -136,3 +146,3 @@ return obj; | ||
.catch(function(ex){ | ||
if (options.verbose>1) console.warn(ex); | ||
if (options.verbose) console.warn(ex); | ||
}); | ||
@@ -159,3 +169,3 @@ } | ||
catch (ex) { | ||
if (options.verbose>1) console.warn(ex); | ||
if (options.verbose) console.warn(ex); | ||
} | ||
@@ -166,3 +176,3 @@ callback(data, target, options); | ||
.catch(function (err) { | ||
if (options.verbose>1) console.warn(err); | ||
if (options.verbose) console.warn(err); | ||
options.cache[target] = {}; | ||
@@ -189,3 +199,3 @@ if (options.promise && options.fatal) options.promise.reject(err); | ||
catch (ex) { | ||
if (options.verbose>1) console.warn(ex); | ||
if (options.verbose) console.warn(ex); | ||
} | ||
@@ -196,3 +206,3 @@ callback(data, target, options); | ||
.catch(function(err){ | ||
if (options.verbose>1) console.warn(err); | ||
if (options.verbose) console.warn(err); | ||
options.cache[target] = {}; | ||
@@ -313,3 +323,3 @@ if (options.promise && options.fatal) options.promise.reject(err); | ||
.catch(function(ex){ | ||
if (options.verbose>1) console.warn(ex); | ||
if (options.verbose) console.warn(ex); | ||
}); | ||
@@ -350,7 +360,7 @@ | ||
.catch(function (ex) { | ||
if (options.verbose>1) console.warn(ex); | ||
if (options.verbose) console.warn(ex); | ||
}); | ||
}) | ||
.catch(function(ex){ | ||
if (options.verbose>1) console.warn(ex); | ||
if (options.verbose) console.warn(ex); | ||
}); | ||
@@ -357,0 +367,0 @@ } |
@@ -186,3 +186,4 @@ // @ts-check | ||
} | ||
if (schema.patternProperties) { | ||
schema.should.not.have.property('patternProperties'); | ||
/*if (schema.patternProperties) { | ||
schema.patternProperties.should.be.an.Object(); | ||
@@ -197,3 +198,3 @@ for (let prop in schema.patternProperties) { | ||
} | ||
} | ||
}*/ | ||
if (typeof schema.enum !== 'undefined') { | ||
@@ -638,2 +639,3 @@ schema.enum.should.be.an.Array(); | ||
let pathParameters = {}; | ||
if (typeof pathItem.parameters !== 'undefined') pathItem.parameters.should.be.an.Array(); | ||
for (let p in pathItem.parameters) { | ||
@@ -725,3 +727,4 @@ contextAppend(options, 'parameters'); | ||
if (op.parameters) { | ||
if (typeof op.parameters !== 'undefined') { | ||
should(op.parameters).be.an.Array(); | ||
let localPathParameters = common.clone(pathParameters); | ||
@@ -728,0 +731,0 @@ let opParameters = {}; |
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
6826
303021
31