【发布时间】:2020-12-08 19:53:58
【问题描述】:
我正在使用 Swagger.AspNetCore 来记录我的 api。到目前为止,我很高兴使用 xml cmets 生成响应模型示例,直到我必须记录嵌入对象。
所以我有简单的模型:
public class SummaryResult
{
/// <summary>Total Cost.</summary>
/// <value>Total Cost.</value>
/// <example>6433.2</example>
public double TotalCost { get; set; }
/// <summary>Owner.</summary>
public Owner Owner { get; set; }
}
public class Owner
{
/// <summary>Owner Name.</summary>
/// <value>Owner Name.</value>
/// <example>Michael</example>
public string Name { get; set; }
}
并且 Swagger UI 仅针对 TotalCost 记录它,所有者属性只是跳过了我所做的任何事情。有谁知道为什么会发生这种情况?以及如何解决它。
我知道如何处理列表 - 只需将顶部的 xml 注释放在 <list></list>
上,但这不是我的情况。
谢谢
【问题讨论】:
标签: c# asp.net-web-api swagger-ui swagger-net