【发布时间】:2019-05-17 20:42:11
【问题描述】:
我希望api能够接受多个查询字符串,例如:
GET /{id}?expand=property1,property2
我将 api 定义为:
public Task<IActionResult> GetAsync([FromRoute] string id, [FromQuery] Expandable expand)
并将Flag Enum Epandable定义为:
[Flags]
[JsonConverter(typeof(StringEnumConverter))]
public enum Expandable
{
None = 0x0,
Property1= 0x1,
Property2 = 0x2,
Property3 = 0x3
}
而参数“expand”的招摇生成为
{
"name": "$expand",
"in": "query",
"description": "",
"required": true,
"type": "string",
"default": "None",
"enum": [
"none",
"property1",
"property2",
"property3"
]
},
但是有了这个招摇,自动生成客户端接受一个字符串,我不确定应该如何呈现招摇,所以自动生成的客户端也会接受一个标志枚举?
【问题讨论】:
-
你应该让
expand参数Expandable[]你的标志被错误地声明stackoverflow.com/questions/8447/…
标签: c# swagger query-string autogen