diff --git a/CHANGELOG.md b/CHANGELOG.md
index db18eb9..657b2d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@
These are the changes to each version that has been released on the [nuget](https://www.nuget.org/packages/Unchase.Swashbuckle.AspNetCore.Extensions/).
+## v2.2.6 `(2020-03-22)`
+
+- [x] Fix bug: add fix #6 to `options.AddEnumsWithValuesFixFilters(true);` when using `JsonStringEnumConverter()`
+
## v2.2.5 `(2020-03-02)`
- [x] Fix bug: hide Paths and Components with `AuthorizeAttribute` applied to the Controller
diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Extensions/EnumTypeExtensions.cs b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Extensions/EnumTypeExtensions.cs
index eb6b8dc..85c132f 100644
--- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Extensions/EnumTypeExtensions.cs
+++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Extensions/EnumTypeExtensions.cs
@@ -47,9 +47,17 @@ internal static string AddEnumValuesDescription(this OpenApiSchema schema, bool
var sb = new StringBuilder();
for (int i = 0; i < schema.Enum.Count; i++)
{
- var value = ((OpenApiInteger)schema.Enum[i]).Value;
- var name = ((OpenApiString)((OpenApiArray)schema.Extensions["x-enumNames"])[i]).Value;
- sb.Append($"{Environment.NewLine}{Environment.NewLine}{value} = {name}");
+ if (schema.Enum[i] is OpenApiInteger schemaEnumInt)
+ {
+ var value = schemaEnumInt.Value;
+ var name = ((OpenApiString)((OpenApiArray)schema.Extensions["x-enumNames"])[i]).Value;
+ sb.Append($"{Environment.NewLine}{Environment.NewLine}{value} = {name}");
+ }
+ else if (schema.Enum[i] is OpenApiString schemaEnumString)
+ {
+ var value = schemaEnumString.Value;
+ sb.Append($"{Environment.NewLine}{Environment.NewLine}{value}");
+ }
// add description from DescriptionAttribute
if (includeDescriptionFromAttribute)
diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj
index b815e45..19afa09 100644
--- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj
+++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj
@@ -14,9 +14,9 @@
7.3
https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/blob/master/assets/icon.png?raw=true
- 2.2.5
- 2.2.5.0
- 2.2.5.0
+ 2.2.6
+ 2.2.6.0
+ 2.2.6.0
false
Unchase.Swashbuckle.AspNetCore.Extensions.xml
diff --git a/test/WebApi3.1-Swashbuckle/Startup.cs b/test/WebApi3.1-Swashbuckle/Startup.cs
index aa1161c..cf39cc7 100644
--- a/test/WebApi3.1-Swashbuckle/Startup.cs
+++ b/test/WebApi3.1-Swashbuckle/Startup.cs
@@ -8,6 +8,7 @@
using System.Collections.Generic;
using System.IO;
using System.Net;
+using System.Text.Json.Serialization;
using TodoApi.Models;
using Unchase.Swashbuckle.AspNetCore.Extensions.Extensions;
using Unchase.Swashbuckle.AspNetCore.Extensions.Filters;
@@ -24,6 +25,7 @@ public class Startup
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
+ //.AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(options =>