swagger-merger icon indicating copy to clipboard operation
swagger-merger copied to clipboard

merger function return dump

Open Themis3000 opened this issue 1 year ago • 0 comments

Right now, it appears that the merger function returns some sort of promise instead of the dump from the resulting merge. It would be nice if I where able to programmatically retrieve the dump without having to write to a file in the process.

Am I missing an important reason as to why this promise is returned instead of the dump? Is there I way I'm missing to get the dump without writing to a file?

e.g. I would like to be able to use this library like this:

//Merge yaml files
const spec = merger({
  input: './src/__docs__/index.yml',
  compact: false
})

//Feed directly into swagger
router.get("/", koaSwagger({
  routePrefix: "/docs",
  specPrefix: "/docs/spec",
  swaggerOptions: {spec}
}))

Edit: for now I forked this repo and frankensteined this functionality in, I won't pull request it because all other features of the repo besides what I'm specifically doing is untested and I have reason to believe it won't work at all haha. Thanks for making this project, it helps tidy up code a lot! After using this it feels like $ref#* should be a feature of swagger/openapi officially

Themis3000 avatar Jul 30 '22 09:07 Themis3000