All About Swagger

I’m Arslan Mirbzergi,in this article I’m going to talk to you about Swagger. Swagger is actually a framework created with the aim of defining an agnostic language (agnostic languages are so flexible that they can do all the work you expect them to do for you) as the interface with REST APIs. This framework allows the computer and the person to access the capacities of the Services without access to source code, files or Internet traffic. If Swagger is defined correctly, the user can remote service and interact with it using the lowest amount of logigator implementation. Swagger removes the guessing section in the service call, such as what interfaces do for lower-level languages. More specializedly, swagger is an efficient and formal tool surrounded by a large bunch of other tools and includes all sections of the interface in Front End, libraries containing low-level codes and commercial and managerial APIs.
What is swagger?

Example of Swagger dependencies

First, we add the following to maven to get started.
What is swagger?
Next, we create the following class and package.
What is swagger?Pay attention to the SwaggerConf class.
What is swagger?Pay attention to the #1 and *1 marked with red boxes. The phrase “com” is the name of the package where all packages and classes are located.
What is swagger?
Pay attention to the #2 and *2 marked with purple boxes. All controllers in this program are started with /rest/ and then the phrases /rest/courses and /rest/teacher are added. That’s why from/rest.*we use.Pay attention to configuration and EnableSwagger2 annotations in the SwaggerConf class.
In the next step, we create a port for the project and create the project, so first we go to the http://localhost:8080/swagger-ui.html address and follow the steps according to the following 3 images.
Figure 1:
What is swagger?
Figure 2:
What is swagger?
Figure 3:
What is swagger?
In this step, in the SwaggerConf class, we will apply changes as shown below.
What is swagger?
That these changes are visible in the following 2 images.
What is swagger?
What is swagger?
At this point we go to the CourseController class.
What is swagger?
After going to the CourseController class at the top of the insert method, we type @Api. In this case, some suggestions will be displayed for us.
What is swagger?
Among the suggestions displayed, we select ApiOperation@.
What is swagger?
You can then see the changes made.
What is swagger?
The following image is also another example.
What is swagger?