我希望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”的 swagger 生成为
{
"name": "$expand",
"in": "query",
"description": "",
"required": true,
"type": "string",
"default": "None",
"enum": [
"none",
"property1",
"property2",
"property3"
]
},
但是有了这个 swagger,自动生成客户端会接受一个字符串,我不确定应该如何呈现 swagger,以便自动生成的客户端也会接受一个 Flag Enum?