express-jsdoc-swagger
express-jsdoc-swagger copied to clipboard
Is it possible to write generated spec to file ?
I see there are options exposeApiDocs
and apiDocsPath
, but the question, is it possible to write generated spec to file without running the express app?
This is very useful if you want to create script to generate spec and you don't need to run app with all dependencies.
May be late to this, but if you use this pattern you can capture the event when it's finished (making sure to turn the server off during config)
const s = expressJSDocSwagger()(options)
s.on('finish', async (swagger_output) => {
console.log(swagger_output)
})
@makorihi : do you also know how to create a file during a Webpack build process?
@mforell my build system is a bit different, but what I did was add the swagger generation command to my package.json script which runs my generation code. I'd suggest doing something like this before the webpack build command (or however else you do it)
"scripts": { "swagger": "node ./swagger.js" }
Thank you very much. I was thinking about programming a webpack plugin, but your idea is much easier.