Amit
Amit

Reputation: 26316

AutoRest does not generate Enum for querystring parameter for C# client SDK

I have an asp.net Web API which accepts Enum from querystring. Swagger doc looks like this:

"parameters": [
      {
        "name": "granularity",
        "in": "query",
        "required": true,
        "type": "string",
        "enum": [
          "Hourly",
          "Daily",
          "Monthly",
          "Realtime",
          "HourlySecondary",
          "DailySecondary",
          "MonthlySecondary",
          "RealtimeSecondary",
          "Weekly",
          "WeeklySecondary"
        ]
      }
]

swagger UI generates dropdown with enum values to select like this: enter image description here

When I use AutoRest to generate C# client SDK, it makes it a string parameter. Is there a way to make it Enum on AutoRest generated client SDK so that those who use my SDK can use Enum instead of having to pass string while calling the API.

Upvotes: 0

Views: 428

Answers (0)

Related Questions