What you read in this article:

All About Swagger

I, Arsalan MirBozorgi, want to talk to you about Swagger. Swagger is actually a framework designed to fully define an agnostic language as an interface to REST IP. Agnostic languages ​​have a lot of flexibility and allow you to do everything you expect them to do. Note that this framework allows the computer as well as the programmer to access the capabilities of the services without access to the source code or Internet traffic. If the Swagger is defined correctly, the user can notice the remote services with the least amount of logical implementation and interact with them directly. The interpreter removes the guessing part of the service call, as interfaces do for lower-level languages. If we want to speak more specifically in this field, we must say that Swagger is a very efficient and formal tool that is surrounded by other very large and complex categories and includes all sections of the user interface in front-end EPI and libraries containing low-level code.
What is swagger?

Example of Swagger dependencies

First, we add the following which we need to maven to get started.

What is swagger?

In the next level, we create the following package and class.

What is swagger?Pay attention to the SwaggerConf class.

What is swagger?Pay Attention to #1 and *1 marked with red boxes. The phrase “com” is the name of the package that contains all the packages and classes.

What is swagger?

Pay attention to #2 and *2 marked with purple boxes. All the controllers of this program start with the address /rest/ and then the expressions / rest/courses and /rest/ teacher are added. For this reason, we use *.reset/ . Note the Configuration and EnableSwagger2 notations in the SwaggerConf class.

In the next step, we create a port for the project and then create the project. For this purpose, we first go to http://localhost:8080/swagger-ui.html 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 level, in the SwaggerConf class, make 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, type @Api at the top of the insert method. In this case, some suggestions are displayed for us.

What is swagger?
Among the suggestions displayed, we select [email protected]
What is swagger?
You can then see the changes made.
What is swagger?
The following image is also another example.
What is swagger?

Leave A Comment

76 + = 83

Please Send Email

Your message sent successfully
There has been an error