Creating documents using Swagger
5 min
Procedure
To create documentation for web services using Swagger you must follow a few steps:
- The class that will be documented should receive the @Api note of the package io.swagger.annotations.Api, which consists of the identification of which category the web service is related to, for example, ticket, change request, etc.
- The identification should be put inside the @Api note, in the property tags, which will receive a value in enum ApiTagsEnum.

imagem 1
- The enum ApiTagsEnum is responsible for storing the categories the web service has. Each enum is composed of the enum value and a Tag class instance (package springfox.documentation.service.Tag), which receives the enum value and the description of the enum.

imagem 1
- After configuring these scenarios, to actually insert the web service documentation, you must create an interface that the web service should implement.

imagem 1
- The interface is where the documentation will be written. These are the most used notations:

imagem 1
- The other notations are commonly used in a web service created with spring, which will be brought to the interface and implemented on the web service.
- To check if the documentation was created successfully, add webmvc/swagger-ui.html# after citsmart/ on the URL.

imagem 1
- It is also possible to access the documentation of the web service directly. Just type the web service path on the URL to see it.

imagem 1