Swagger is mostly used for documenting services and testing services out. There are two fundamental approaches in implementing Swagger. They are as follows:
- Top-down or design-first approach: Here, Swagger Editor is used to create Swagger definitions and then Swagger Code-gen is used to generate code for the client as well as the server. Swagger will be used to design the API and source before any of the code has been written.
- Bottom-up approach: Here, for any of the existing APIs, Swagger is used to generate documentation.
We will look at both of the approaches along with the best practices available for us.