Closed scottbishopdev closed 4 years ago
Might be worth looking at tsoa, which will (I think) automatically generate an OpenAPI doc from a TypeScript-based API.
So, while working on this, I've realized that there's a lot of potential in combining this OpenAPI document with TypeScript. In theory, we could generate ES6 classes from the OpenAPI doc, use typegoose to base our mongoose schemas from those ES6 classes, and use something like express-openapi to do routing (and potentially code generation) for the endpoints defined within. In theory, this could automate the implementation of stuff that's defined by the API contract, and also eliminate a pretty significant chunk of the boilerplate code in the project, leaving us just the implementation of the actual behavior of our services to do.
First and foremost, can we admire the name of this issue? "Implement Swagger"? Hell yeah we're gonna. 😎
Now that that's out of the way, We should implement Swagger in some form or another to document our API. This also means implementing an OpenAPI v3 document that describes the contract of the server's API. Implementing Swagger will also assist in testing future API-related changes, as it enables some cool automation in applications like Postman.