Fil*_*991 2 xml parameters swagger swashbuckle asp.net-core
我在 net core 中使用 swashbuckle 创建一个 swagger 记录的 API。
我的函数使用查询参数。我想在输入参数值的文本框旁边为每个查询参数添加简短描述。我通过使用 XML 注释实现了这一点:
/// <param name="propertyId">The integration property ID. Events related to presentations related to this ID will be returned</param>
public ActionResult GetEvents([BindRequired] string propertyId){}
Run Code Online (Sandbox Code Playgroud)
我发现如果生成的 JSON 具有查询参数的“示例”值,则可以更改占位符。如何添加示例值,或者如何使用 XML 注释或类似内容更改占位符?
您可以尝试添加example="xxx"到<param></param>添加示例值并更改占位符。
/// <param name="propertyId" example="id">The integration property ID. Events related to presentations related to this ID will be returned</param>
public IActionResult GetEvents([BindRequired] string propertyId) {
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4856 次 |
| 最近记录: |