如何在ASP中使用Swagger将注释显示为描述段落.. NET核心API



我有一个web api在asp.net-core,我想知道如何把段落作为结束点的描述?我试过

n n,没有效果。我把描述放在"备注"中。xml。

感谢

首先,您必须配置Swashbuckle以使用文档XML。

然后,使用<summary><remarks>标记进行操作总结和描述。

/// <summary>
/// Summary for ActionWithSummaryAndRemarksTags
/// </summary>
/// <remarks>
/// Remarks for ActionWithSummaryAndRemarksTags
/// </remarks>
public ActionResult ActionWithSummaryAndRemarksTags()

您可以使用Markdown来构造更复杂的文档:

/// <summary>
/// This is a short summary
/// </summary>
/// <remarks>
/// ## Usage
/// ...
/// ```
/// <![CDATA[
/// {
///   "html": "<h1>escape HTML with CDATA blocks</h1><img src="https://unsplash.it/400/200" />"
/// }
/// ]]>
/// ```
///
/// ### A title
/// A paragrapth with [a link](https://example.com).
/// 
/// ```html
/// <h1>hello world, this is a code block</h1>
/// <img src="data:image/jpg,base64;..." />
/// ```
/// This is an inline code `https://unsplash.it/200/100`.
///
/// This is a separate paragraph
/// </remarks>

最新更新