scottbishopdev / RoverInterviewProject

A project I completed in about two weeks while interviewing for Rover.com in 2018. This is a re-upload of my original Rover_Interview_Project repo.
GNU General Public License v3.0
0 stars 0 forks source link

Implement Swagger #20

Closed scottbishopdev closed 4 years ago

scottbishopdev commented 4 years ago

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.

scottbishopdev commented 4 years ago

Might be worth looking at tsoa, which will (I think) automatically generate an OpenAPI doc from a TypeScript-based API.

scottbishopdev commented 4 years ago

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.