In the previous post, I introduced Swagger and showed how to set up your project for Swagger. In this post I will show how to add Swagger comments to annotate your program.
In earlier posts we looked at the database of cars and the Get method that retrieves the entire list. That can be quite a lot of data going over the wire. What we want instead is to send pages. I’ll show that briefly and then we’ll annotate that code.
In the CarController we’ll have a Get method that takes three parameters: showDeleted, pageNumber and pageSize. The first we’ve seen before, it determines whether the list returned to the caller will include our deleted records. The second, pageNumber, will designate which page of data we want to return (zero based). The third parameter, pageSize, will designate how many records to return per page.
Thus, if we were to write
Get(false,3,4)
we would expect to get back records 17, 18, 19 and 20, because page 0 would have records 1-4, page 1 would have 5-8, etc.
Here is the compete endpoint that will directly call our repository (we won’t bother with a service for this example).
public async Task<IEnumerable<Car>> Get([FromRoute] bool showDeleted, int pageNumber, int pageSize )
{
return await _carRepository.Get(showDeleted, pageNumber, pageSize);
}
When the repository is called, the parameters are passed in, and it does its magic. For now, however, we are only concerned with documenting this method. We do that with XML comments, designated by three forward slash marks (///).
First, we will document the purpose of the endpoint; that is, what it does. We do that in the summary
/// <summary>
/// Get all the cars in the Database
/// </summary>
Next, we want to document the parameters
/// <param name="returnDeletedRecords">If true, the method will return all the records,
/// including the ones that have been deleted</param>
/// <param name="pageOffset">which page to display</param>
/// <param name="pageSize">how many records to display per page</param>
Finally, I’m going to document the possible response codes. Note, these are, by no means, all that you can document, but they’ll give us a good idea of how it is done
/// <response code="200">Cars returned</response>
/// <response code="404">Specified Car not found</response>
/// <response code="500">An Internal Server Error prevented the request from being executed.</response>
When an error is encountered and we return one of these codes, the text we’ve specified goes along for the ride, which is enormously helpful to the calling client.
At the top of the swagger page is our summary

At each parameter is our designated text

Finally, each of the error codes is documented

It is a best practice to document all of the endpoints. Many developers go further, and document all of the methods in both the service and the repository; that is a decision to be made by the team. Since the endpoint is the only thing visible to the client, it has the greatest claim on your time and effort. Remember, “comments rust,” and that is as true for Swagger comments as any other.






































WebSite: https://repaircddvd.com
RepairCdDvD v2.7 is a data recovery tool designed for recovering information from damaged CD and DVD media, effectively restoring data from corrupted DVDs. This software proves very helpful in cases when discs are scratched or poorly recorded. The operations of the program are performed without any risk, and the process of disk repair is carried out by means of an ISO image.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
https://repaircddvd.com
WebSite: https://repaircddvd.com
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
RepairCdDvD v2.7 is a data recovery tool designed for recovering information from damaged CD and DVD media, effectively restoring data from corrupted DVDs. This software proves very helpful in cases when discs are scratched or poorly recorded. The operations of the program are performed without any risk, and the process of disk repair is carried out by means of an ISO image.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
RepairCdDvD v2.7 is a data recovery tool designed for recovering information from damaged CD and DVD media, effectively restoring data from corrupted DVDs. This software proves very helpful in cases when discs are scratched or poorly recorded. The operations of the program are performed without any risk, and the process of disk repair is carried out by means of an ISO image.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
WebSite: https://repaircddvd.com
บทความนี้ ให้ข้อมูลดี ครับ
ผม เพิ่งเจอข้อมูลเกี่ยวกับ เนื้อหาในแนวเดียวกัน
สามารถอ่านได้ที่ 12play
เผื่อใครสนใจ
เพราะให้ข้อมูลเชิงลึก
ขอบคุณที่แชร์ คอนเทนต์ดีๆ นี้
และอยากเห็นบทความดีๆ แบบนี้อีก
WebSite: https://repaircddvd.com
https://repaircddvd.com
WebSite: https://repaircddvd.com
WebSite: https://repaircddvd.com
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
RepairCdDvD v2.7 is a data recovery tool designed for recovering information from damaged CD and DVD media, effectively restoring data from corrupted DVDs. This software proves very helpful in cases when discs are scratched or poorly recorded. The operations of the program are performed without any risk, and the process of disk repair is carried out by means of an ISO image.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
WebSite: https://repaircddvd.com
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
WebSite: https://repaircddvd.com
https://repaircddvd.com
บทความนี้ อ่านแล้วได้ความรู้เพิ่ม ค่ะ
ผม ได้อ่านบทความที่เกี่ยวข้องกับ เนื้อหาในแนวเดียวกัน
ที่คุณสามารถดูได้ที่ pompom 456
เผื่อใครสนใจ
มีการยกตัวอย่างที่เข้าใจง่าย
ขอบคุณที่แชร์ ข้อมูลที่มีประโยชน์
นี้
จะรอติดตามเนื้อหาใหม่ๆ ต่อไป
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
RepairCdDvD v2.7 is a data recovery tool designed for recovering information from damaged CD and DVD media, effectively restoring data from corrupted DVDs. This software proves very helpful in cases when discs are scratched or poorly recorded. The operations of the program are performed without any risk, and the process of disk repair is carried out by means of an ISO image.
Kunststof Brillenmonturen NieuwegeinErfstede, 3431
KH Nieuwegeinhttps://kunststofkozijnennieuwegein.nl/Kunststof brillenmonturen verschaffen veelzijdige opties in Nederland.
Kunststof brillenmonturen ondersteunen een brede keuze
in kleuren en vormen. Kunststof brillenmonturen helpen zowel herenbrillen als damesbrillen. Kunststof brillenmonturen verschaffen ook kinderbrillen en sportbrillen. Kunststof brillenmonturen verlenen een assortiment van transparante en gekleurde
monturen. Kunststof brillenmonturen ondersteunen voor comfortabele pasvormen door lichtgewicht materiaal.
Kunststof brillenmonturen verlenen garantie op duurzaamheid.
Kunststof brillenmonturen bieden multifocale
glazen voor verschillende sterktes. Kunststof
brillenmonturen ondersteunen oogzorg met een oogmeting.
Kunststof brillenmonturen faciliteren de optie om zonnebrillen te bestellen. Kunststof brillenmonturen bieden acetaat
en plastic als materiaalkeuze. Kunststof brillenmonturen leveren transparante kunststof
brillenglazen. Kunststof brillenmonturen bieden titanium en metalen als alternatieve monturen. Kunststof brillenmonturen faciliteren voor een breed assortiment aan merken. Kunststof brillenmonturen bieden aantrekkelijke prijzen voor elke klant.
Kunststof brillenmonturen ondersteunen onderhoud en reparatie.
Kunststof brillenmonturen helpen ook de keuze voor multifocale lenzen.
Kunststof brillenmonturen verschaffen coatings voor extra
bescherming. Kunststof brillenmonturen verschaffen leesbrillen voor optimaal zicht.
Kunststof brillenmonturen verlenen een collectie van moderne en klassieke stijlen.
Kunststof brillenmonturen leveren ook op maat gemaakte oplossingen. Kunststof brillenmonturen ondersteunen een naadloze brillenervaring in Nederland.
Kunststof brillenmonturen verlenen een perfecte balans
tussen stijl en functionaliteit. Kunststof brillenmonturen helpen een innovatieve kijk op brillenmode.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
https://repaircddvd.com
https://repaircddvd.com
WebSite: https://repaircddvd.com
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
RepairCdDvD v2.7 is a data recovery tool designed for recovering information from damaged CD and DVD media, effectively restoring data from corrupted DVDs. This software proves very helpful in cases when discs are scratched or poorly recorded. The operations of the program are performed without any risk, and the process of disk repair is carried out by means of an ISO image.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
RepairCdDvD v2.7 is a software tool designed to retrieve data from scratched or damaged CDs and DVDs, including formats such as CD+R/RW and DVD+R/RW, BD.
WebSite: https://repaircddvd.com
https://repaircddvd.com
WebSite: https://repaircddvd.com
ข้อมูลชุดนี้ มีประโยชน์มาก ค่ะ
ผม ได้อ่านบทความที่เกี่ยวข้องกับ
เนื้อหาในแนวเดียวกัน
ซึ่งอยู่ที่ Shauna
เผื่อใครสนใจ
เพราะอธิบายไว้ละเอียด
ขอบคุณที่แชร์ ข้อมูลที่มีประโยชน์ นี้
และอยากเห็นบทความดีๆ แบบนี้อีก