我们使用Swashbuckle 5.6.0。问题在于,当自动生成的swagger文档的参数是使用 [FromUri] 属性修饰的类的属性时,这些参数不会显示参数说明-请参见屏幕截图。
我尝试了XML摘要并标记了注释以及属性 DisplayName 和 Description ,但是我不能大张旗鼓地显示参数说明。 (如何)可以实现?
Web API控制器中的方法:
/// <summary>
/// Gets all folders.
/// </summary>
/// <param name="accountId">
/// Required account ID.
/// </param>
/// <param name="requestOptions">
/// The request options for the method.
/// </param>
public async Task<IHttpActionResult> GetFoldersAsync(int accountId, [FromUri(Name = "")] GetFoldersRequestOptions requestOptions)
{
// method content
}
类 GetFoldersRequestOptions
public class GetFoldersRequestOptions
{
/// <summary>
/// Summary of 'Type'
/// </summary>
/// <remarks>
/// Remarks of 'Type'
/// </remarks>
[Description("Description of 'Type'")]
[DisplayName("DisplayName of 'Type'")]
public int? Type { get; set; }
/// <summary>
/// Summary of 'Load'
/// </summary>
/// <remarks>
/// Remarks of 'Load'
/// </remarks>
[Description("Description of 'Load'")]
[DisplayName("DisplayName of 'Load'")]
public string[] Load { get; set; }
}