Open NeraNodes opened 4 years ago
Same general issue here. It differs quite much!
I think it is not promising that this issue is still open and no one did comment on it...
:-(
@NeraNodes @ChristianHauwert Hm - the OpenAPI module and the Postman app construct collections a little differently. Can you explain your workflow/requirements that require you to merge collections from these two sources?
When I import a Openapi yaml into Postman, and then export as Postman (2.1) Collection, the json looks different from how the json looks, when I use openapi-to-postman to convert to postman collection (Although both work when imported into Postman).
I am currently writing a script, which takes an older Postman-exported json collection. Then takes a new Openapi yaml, converts it with openapi-to-postman to postman collection. And then merges them.
However, since the semantics etc are not similar this won't work. But if I take the new yaml into Postman, export it, then I am able to merge the two files correctly.
Shouldn't converting with openapi-to-postman and exporting from Postman give the same result?
My code:
openapiData = fs.readFileSync(inputyaml, {encoding: 'UTF8'}); Converter.convert({ type: 'string', data: openapiData }, {}, (err, conversionResult) => { if (!conversionResult.result) { console.log('Could not convert', conversionResult.reason); } else { fs.writeFileSync(outputfile, JSON.stringify(conversionResult.output[0].data, 'utf8', 2)); } } );
Compared the two files in json diff and they are different semantically, but the converted one also have a lot of empty "event" arrays. Can't share entire thing, due to it being a work project.