Swagger for the controller
Swagger documentation is implemented using XML comments. XML comments are preceded by three slash marks. Here’s an example:
/// XML comment
XML comments are paired tags, such as the following:
/// <summary> … /// </summary>
Let’s start with the controller of our Cars application. We’re going to put Swagger documentation above every method in the controller.
The first comment we’ll add is the summary:
/// <summary> /// Get all the cars in the Database /// </summary>
This comment will appear next to the route for the GET button, as shown in Figure 4.4:
Figure 4.4 – Display the summary
Before we go any further, let’s look at what we get from Swagger without writing any additional code.
Swagger out of the box
Note that Swagger will come up automatically just after you start your application.
To see the auto-generated documentation...