diff --git a/index.js b/index.js index b2b73b6..b65ac07 100644 --- a/index.js +++ b/index.js @@ -59,13 +59,7 @@ module.exports = { reason: err }); }); - }, (err) => { - if (err) { - return cb(null, { - result: false, - reason: _.toString(err.reason) - }); - } + }, () => { var conversionResult = false, convertedCollections = [], diff --git a/lib/convert.js b/lib/convert.js index 3a794e6..d0f7705 100644 --- a/lib/convert.js +++ b/lib/convert.js @@ -261,9 +261,7 @@ var sdk = require('postman-collection'), module.exports = { convert: function(json, options, callback) { try { - converter.convert(json, options, (err, result) => { - callback(null, result); - }); + converter.convert(json, options, callback); } catch (e) { if (e instanceof OpenApiErr) { diff --git a/lib/parse.js b/lib/parse.js index 88eebeb..086bbc8 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -103,14 +103,14 @@ module.exports = { getOasObject: function (file) { let oasObj = file; - if (typeof file === 'string') { + if (typeof oasObj === 'string') { try { - oasObj = JSON.parse(file); + oasObj = JSON.parse(oasObj); } catch (jsonEx) { // Not direct JSON. Could be YAML try { - oasObj = yaml.safeLoad(file); + oasObj = yaml.safeLoad(oasObj); } catch (yamlEx) { // Not JSON or YAML