swagger-controllers
Convert opinionated typescript ES6 classes to swagger documentation.
The bulk of this work is taken from tsoa. A big thanks to all of the contributors to that project.
Why not just use tsoa?
Running a command to generate express routes from classes never sat well with me, mostly due to debugging.
Is this a replacement for tsoa?
Not at all. All this library does is use typescript to generate a swagger.json file from classes that have been defined. It is up to you to convert these classes to routes somehow.
Example
;
The above example ES6 Typescript class will produce a swagger.json schema file with 3 definitions and 2 API endpoints.
How to use
// load any es6 controllers by path // see SwaggerConfig interface for complete options // genearte a JSON Swagger.Spec object. // usual express/swagger-ui-express stuff.app.use'/docs', swagger.serve, swagger.setupdocumentapp.listen8888,