Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async.map(apis, executeFetch, (err, result) => {
if (err) {
onLoadError(`Error loading Swagger 1.x apis: ${err}`)
console.error(err)
} else {
onLoadProgress(`Loading of Swagger spec 1.x completed.`)
let apiDeclarations = {}
result.forEach(element => { apiDeclarations[element.path] = element.result })
onLoadProgress('Started to convert Swagger 1.x to Swagger 2.0....')
const swagger2Document = SwaggerConverter.convert(apiSpec, apiDeclarations)
onLoadProgress('Convertion from Swagger 1.x to Swagger 2.0 completed!')
swagger2Document.info.title = swagger2Document.info.title === 'Title was not specified' ? 'API' : swagger2Document.info.title
swagger2JsonLoader(swagger2Document, config.friendlyName, config.slug, defaultHost, { onLoadProgress, onNewAPI, onNewOperation, onNewDefinition, onLoadCompleted, onLoadError })
}
})
})
this.converters.swagger_2 = Promise.method((swagger1, passthrough) => {
passthrough = passthrough || {};
passthrough.buildTagsFromPaths = passthrough.buildTagsFromPaths !== false;
var swagger2 = SwaggerConverter.convert(
swagger1.spec,
swagger1.subResources,
passthrough
);
if (swagger2.info.title === 'Title was not specified')
swagger2.info.title = swagger2.host;
return swagger2;
});
Swagger1.prototype.listSubResources = function () {
return SwaggerConverter.listApiDeclarations(this.source, this.spec);
};