Skip to main content

Swagger–Expose enums as strings in your Web API

By default Swagger exposes enums in your API definitions as numbers which makes it not easy to understand what a specific parameter value means.

image

You can configure Swagger to expose enums using string names instead. Therefore add the following line to your Swagger configuration:

 c.DescribeAllEnumsAsStrings();

image