one minute of reading
Swagger is a tool that is used to create API (application programming interface) documentation. With Swagger, it is possible to easily create and edit API documentation, as well as share it with others.
Table of contents
Swagger, an OpenAPI, makes it possible to describe a REST API using a JSON file. This standard is understood by other APIs, and developers using it can share information among themselves using a standardized format, as well as create documentation for the API to code later. Swagger consists of 3 main components: Editor, Codegen and UI. Each of these elements has a specific role, and so with the Editor we can generate visually clear APIs, with Codegen we can generate Server Stubs and SDKs for clients, and with the UI we can integrate with our APIs and generate online documentation for them, which would update with changes made to the code.
Swagger UI in practice
Swagger in practice boils down to displaying interactive REST API documentation with which to test and invoke queries through integration with our code. All commands are described in detail, along with the information that the API accepts and also returns. More advanced configurations take into account authorizations as well as the roles that are available to individual users. An Admin type user can see more types of queries, while a non-admin user can see fewer.