olivierlsc/swagger-express-ts

Question: how to generate swagger.json and save to disk?

viglucci opened this issue · 1 comments

How would one go about creating a swagger.json definition using this library?

I see that once we start our app, a swagger.json is available at a configured endpoint, but is there any way to get this swagger.json to be written to disk during some type of build step?

It would be valuable to be able to output the generated swagger.json to disk so that it could be used to configure other tools, or to generate a static documentation site, etc.

Thanks

Hello :)

I'm not sure about this. But the swagger express endpoint do this :

let data : ISwagger = SwaggerService.getInstance().getData();

which must be the swagger.json as object. Perhaps you can simply call the same code and stringify this one and save it in a file when your server start