![](/img/trans.png)
[英]Swashbuckle request parameters not working when using custom model binder
[英]Show descriptions for model properties which are custom types using Swashbuckle
我有这个模型:
public class Order {
/// <summary>
/// The customer.
/// </summary>
public Customer Customer { get; set; }
}
public class Customer {
/// <summary>
/// This is not shown. <---
/// </summary>
public int Id { get; set; }
/// <summary>
/// This is not shown. <---
/// </summary>
public string Name { get; set; }
}
Customer
类在单独的程序集中定义。
swagger ui 不显示Customer
模型的Id
和Name
属性的描述。
options.UseAllOfToExtendReferenceSchemas();
options.UseAllOfForInheritance();
我怎样才能解决这个问题?
必须包含所有 XML 文件,而不仅仅是条目程序集的 XML 文件。
var dir = AppContext.BaseDirectory;
var paths = Directory.GetFiles(dir, "*.xml", SearchOption.TopDirectoryOnly);
foreach (var path in paths) o.IncludeXmlComments(path);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.