Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get JSON formatting when adding Swashbuckle remarks?

I have been following this tutorial on Swashbuckle but when I add remarks they appear as regular text not the JSON shown in the remarks section. Is it possible to get JSON formatting?

like image 965
nathanjw Avatar asked Oct 16 '25 14:10

nathanjw


2 Answers

/// <remarks>
/// Sample request:
///
///     POST /Todo
///     {
///        "id": 1,
///        "name": "Item1",
///        "isComplete": true
///     }
///
/// </remarks>

Make sure Sample Request is not indented!

like image 78
nathanjw Avatar answered Oct 18 '25 08:10

nathanjw


A minor follow up to the accepted answer.

You can create separate areas in the <remarks> section:

/// <remarks>
/// Sample request:
///
///     POST /Todo
///
/// Result format:
///
///     {
///        "id": 1,
///        "name": "Item1",
///        "isComplete": true
///     }
///
/// </remarks>

enter image description here

like image 36
Ryan Naccarato Avatar answered Oct 18 '25 09:10

Ryan Naccarato



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!