mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Removing async await implementation and using callback implementation instead. Fixin the related tests
28 lines
704 B
JavaScript
28 lines
704 B
JavaScript
const Swagger2OpenAPI = require('swagger2openapi'),
|
|
{ isSwagger } = require('../common/versionUtils');
|
|
|
|
module.exports = {
|
|
convertSwaggerToOpenapi: function(concreteUtils, parsedSwagger, convertExecution) {
|
|
if (isSwagger(concreteUtils.version)) {
|
|
Swagger2OpenAPI.convertObj(
|
|
parsedSwagger,
|
|
{
|
|
fatal: false,
|
|
patch: true,
|
|
anchors: true,
|
|
warnOnly: true
|
|
},
|
|
(error, newOpenapi) => {
|
|
if (error) {
|
|
return convertExecution(error);
|
|
}
|
|
return convertExecution(null, newOpenapi.openapi);
|
|
}
|
|
);
|
|
}
|
|
else {
|
|
return convertExecution(null, parsedSwagger);
|
|
}
|
|
}
|
|
};
|