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.






































trafficmint.click – Appreciate the typography choices; comfortable spacing improved my reading experience.
rankstorm.click – Color palette felt calming, nothing distracting, just focused, thoughtful design.
growthorbit.click – Content reads clearly, helpful examples made concepts easy to grasp.
viralsphere.click – Color palette felt calming, nothing distracting, just focused, thoughtful design.
adprox.click – Loved the layout today; clean, simple, and genuinely user-friendly overall.
digitalpilot.click – Mobile version looks perfect; no glitches, fast scrolling, crisp text.
trafficmint.click – Mobile version looks perfect; no glitches, fast scrolling, crisp text.
growthorbit.click – Bookmarked this immediately, planning to revisit for updates and inspiration.
viralsphere.click – Loved the layout today; clean, simple, and genuinely user-friendly overall.
adprox.click – Pages loaded fast, images appeared sharp, and formatting stayed consistent.
funnelfuel.click – Color palette felt calming, nothing distracting, just focused, thoughtful design.
digitalpilot.click – Overall, professional vibe here; trustworthy, polished, and pleasantly minimal throughout.
528148.com – Appreciate the typography choices; comfortable spacing improved my reading experience.
743728.com – Found practical insights today; sharing this article with colleagues later.
745748.com – Pages loaded fast, images appeared sharp, and formatting stayed consistent.
amcbuildingmaterials.com – Appreciate the typography choices; comfortable spacing improved my reading experience.
9044123.com – Found practical insights today; sharing this article with colleagues later.
743748.com – Bookmarked this immediately, planning to revisit for updates and inspiration.
743728.com – Color palette felt calming, nothing distracting, just focused, thoughtful design.
745748.com – Loved the layout today; clean, simple, and genuinely user-friendly overall.
amcbuildingmaterials.com – Found practical insights today; sharing this article with colleagues later.
9044123.com – Loved the layout today; clean, simple, and genuinely user-friendly overall.
Английский сегодня считается необходимым инструментом для каждого человека.
Он позволяет общаться с людьми со всего мира.
Без знания английского трудно развиваться профессионально.
Многие компании предпочитают специалистов с языковыми навыками.
курсы подготовки к toefl
Изучение языка делает человека увереннее.
Благодаря английскому, можно читать оригинальные источники без ограничений.
Помимо этого, регулярная практика развивает память.
Таким образом, умение говорить по-английски является залогом в будущем каждого человека.
Английский сегодня считается обязательным навыком для современного человека.
Он помогает находить общий язык с людьми со всего мира.
Без владения языком трудно достигать успеха в работе.
Многие компании оценивают специалистов с языковыми навыками.
https://volst.ru/proizvodstvennye-linii/avtomaticheskoe-povtornoe-vkljuchenie-apv/
Регулярная практика английского расширяет кругозор.
С помощью английского, можно учиться за границей без трудностей.
Также, овладение английским развивает память.
Таким образом, умение говорить по-английски играет важную роль в будущем каждого человека.
Знание английского языка сегодня считается незаменимым умением для современного человека.
Он дает возможность общаться с жителями разных стран.
Не зная английский трудно развиваться профессионально.
Многие компании требуют специалистов с языковыми навыками.
подготовка к toefl в москве
Регулярная практика английского делает человека увереннее.
Зная английский, можно учиться за границей без перевода.
Кроме того, изучение языка улучшает мышление.
Таким образом, знание английского языка является залогом в будущем каждого человека.
Английский сегодня считается незаменимым инструментом для современного человека.
Он помогает взаимодействовать с жителями разных стран.
Без знания английского почти невозможно достигать успеха в работе.
Организации оценивают знание английского языка.
индивидуальные занятия по английскому языку
Изучение языка делает человека увереннее.
Благодаря английскому, можно учиться за границей без перевода.
Также, изучение языка развивает память.
Таким образом, владение английским является залогом в успехе каждого человека.
214248.com – Mobile version looks perfect; no glitches, fast scrolling, crisp text.
mastersaita.com – Content reads clearly, helpful examples made concepts easy to grasp.
speakenglishlikeagenius.com – Pages loaded fast, images appeared sharp, and formatting stayed consistent.
qcxrmyy.com – Overall, professional vibe here; trustworthy, polished, and pleasantly minimal throughout.
745648.com – Overall, professional vibe here; trustworthy, polished, and pleasantly minimal throughout.
yhwhcyy.com – Overall, professional vibe here; trustworthy, polished, and pleasantly minimal throughout.
214248.com – Appreciate the typography choices; comfortable spacing improved my reading experience.
wahoowebsite.com – Pages loaded fast, images appeared sharp, and formatting stayed consistent.
mastersaita.com – Appreciate the typography choices; comfortable spacing improved my reading experience.
speakenglishlikeagenius.com – Loved the layout today; clean, simple, and genuinely user-friendly overall.
qcxrmyy.com – Mobile version looks perfect; no glitches, fast scrolling, crisp text.
аренда мебели для выставок москва Экспозиционное оборудование для экспозиций в Москве. Универсальные решения с профессиональной установкой.
Английский сегодня считается необходимым умением для каждого человека.
Английский язык дает возможность взаимодействовать с людьми со всего мира.
Не зная английский сложно строить карьеру.
Многие компании требуют знание английского языка.
английский для it специалистов
Регулярная практика английского расширяет кругозор.
Зная английский, можно учиться за границей без ограничений.
Помимо этого, изучение языка улучшает мышление.
Таким образом, знание английского языка становится ключом в успехе каждого человека.
Знание английского языка сегодня считается важным умением для жителя современного мира.
Он позволяет находить общий язык с жителями разных стран.
Не зная английский почти невозможно достигать успеха в работе.
Работодатели предпочитают сотрудников, владеющих английским.
wiki.3cdr.ru
Обучение английскому делает человека увереннее.
Благодаря английскому, можно путешествовать без трудностей.
Кроме того, изучение языка улучшает мышление.
Таким образом, владение английским становится ключом в успехе каждого человека.
Знание английского языка сегодня считается обязательным умением для каждого человека.
Он позволяет общаться с людьми со всего мира.
Без владения языком трудно строить карьеру.
Многие компании оценивают знание английского языка.
английский для программистов
Регулярная практика английского делает человека увереннее.
С помощью английского, можно путешествовать без перевода.
Также, регулярная практика повышает концентрацию.
Таким образом, знание английского языка является залогом в успехе каждого человека.
Adult dating sites help users to find new acquaintances.
They are designed for those who seek honest interaction.
Such platforms offer a comfortable space for getting to know others online.
Thousands of users turn to online dating to broaden their circle.
https://1sexxx.ru/
The purpose of such platforms is to bring together adults who want compatible relationships.
Respectful communication on these platforms helps establish real contact.
Modern technology make dating more accessible than ever before.
Ultimately, modern dating services make relationships possible regardless of location.
Dating platforms for adults allow people to meet new acquaintances.
They are created for those who appreciate open communication.
These services offer a convenient space for communicating with others in a virtual format.
Thousands of users choose online dating to explore new experiences.
https://masaged.info/
The purpose of such platforms is to connect users who want compatible relationships.
Respectful communication on these platforms helps establish real contact.
Online communication formats make dating easier than ever before.
Ultimately, modern dating services help people feel connected regardless of location.
a0133.com – Mobile version looks perfect; no glitches, fast scrolling, crisp text.
Dating platforms for adults make it easier for people to meet like-minded partners.
They are designed for those who appreciate honest interaction.
These services offer a comfortable space for getting to know others in a virtual format.
A lot of people prefer online dating to broaden their circle.
https://masaged.info/
The main goal of such platforms is to bring together adults who share similar interests.
Responsible use on these platforms helps build trust.
Digital tools make dating more accessible than ever before.
Ultimately, modern dating services help people feel connected regardless of busy schedules.
Английский язык сегодня считается важным инструментом для современного человека.
Английский язык помогает находить общий язык с иностранцами.
Не зная английский сложно развиваться профессионально.
Многие компании предпочитают специалистов с языковыми навыками.
английский для разработчиков
Регулярная практика английского расширяет кругозор.
Благодаря английскому, можно читать оригинальные источники без ограничений.
Помимо этого, изучение языка развивает память.
Таким образом, знание английского языка играет важную роль в саморазвитии каждого человека.
Знание английского языка сегодня считается важным инструментом для каждого человека.
Английский язык помогает общаться с людьми со всего мира.
Без владения языком почти невозможно строить карьеру.
Многие компании оценивают сотрудников, владеющих английским.
английский для подростков
Обучение английскому расширяет кругозор.
Зная английский, можно путешествовать без ограничений.
Помимо этого, изучение языка развивает память.
Таким образом, знание английского языка играет важную роль в будущем каждого человека.
мебель в аренду в москве недорого Недорогая мебель в временное пользование в Москве. Качественный сервис по доступным ценам.
joinbtba.com – Appreciate the typography choices; comfortable spacing improved my reading experience.
hlfsxx.com – Pages loaded fast, images appeared sharp, and formatting stayed consistent.