Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to write generated spec to file ? #196

Open
Ilchuk-Mihail opened this issue Oct 26, 2021 · 4 comments
Open

Is it possible to write generated spec to file ? #196

Ilchuk-Mihail opened this issue Oct 26, 2021 · 4 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@Ilchuk-Mihail
Copy link

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.

@kevinccbsg kevinccbsg added enhancement New feature or request question Further information is requested labels Oct 26, 2021
@makorihi
Copy link

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)
})

@mforell
Copy link

mforell commented Mar 24, 2022

@makorihi : do you also know how to create a file during a Webpack build process?

@makorihi
Copy link

@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" }

@mforell
Copy link

mforell commented Mar 28, 2022

Thank you very much. I was thinking about programming a webpack plugin, but your idea is much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants