0

I want the api to be able to accept multiple query strings, for example:

GET /{id}?expand=property1,property2

I have the api defined as:

public Task<IActionResult> GetAsync([FromRoute] string id, [FromQuery] Expandable expand)

And Flag Enum Epandable defined as:

        [Flags]
        [JsonConverter(typeof(StringEnumConverter))]
        public enum Expandable
        {
            None = 0x0,
            Property1= 0x1,
            Property2 = 0x2,
            Property3 = 0x3
        }

And the swagger for parameter "expand" generated as

          {
            "name": "$expand",
            "in": "query",
            "description": "",
            "required": true,
            "type": "string",
            "default": "None",
            "enum": [
              "none",
              "property1",
              "property2",
              "property3"
            ]
          },

But with this swagger, the auto-gen client takes in a string, I am not sure how the swagger should be presented so the auto-generated client would also take in a Flag Enum?

4

1 回答 1

0

您还应该设置expand参数Expandable[]您的标志声明不正确[Flags] 枚举属性在 C# 中是什么意思?

于 2019-05-17T22:46:42.423 回答