0

Is it possilbe in Swashbuckle.AspNetCore.Swagger (6.1.1) to get such enum with names? I need better names for generate API client for frontend app.

public enum BasketResourceEnum
{
    Stocks = 1,
    Currencies
}

Now I get such representation in json, I need name instead of int values

  "BasketResourceEnum": {
    "enum": [
      1,
      2
    ],
    "type": "integer",
    "format": "int32"
  },
Jacek
  • 11,107
  • 22
  • 62
  • 116
  • Maybe that could help you: https://stackoverflow.com/questions/36452468/swagger-ui-web-api-documentation-present-enums-as-strings – TheTanic Mar 31 '21 at 08:10

1 Answers1

0
services
    .AddControllers()
    .AddJsonOptions(options => 
        options.SerializerSettings.Converters.Add(new StringEnumConverter()));
user3119533
  • 91
  • 1
  • 6