【发布时间】:2016-04-07 11:02:19
【问题描述】:
看起来 swashbuckle (5.2.2) 生成了无效的字段名。我有一个(部分)看起来像这样的模型,所有属性都有一个后缀为“Field”的支持字段
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,
Namespace = "http://SomeCompany.Web.Service")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://SomeCompany.Web.Service", IsNullable = false)
]
public partial class GetOrderLines
{
private string orderNumberField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
public string OrderNumber
{
get
{
return this.orderNumberField;
}
set
{
this.orderNumberField = value;
}
}
}
控制器方法签名如下所示:
public GetOrderLinesResponse Get([FromUri]GetOrderLines request)
{
}
生成的文档如下所示:
它使用私有字段的名称而不是使用属性的名称。这是预期的行为吗?有什么办法可以解决这个问题并获得实际属性吗?
【问题讨论】:
标签: swagger swagger-ui swashbuckle