unchase / Unchase.Swashbuckle.AspNetCore.Extensions

:hammer: A library contains a bunch of extensions (filters) for Swashbuckle.AspNetCore.
https://www.nuget.org/packages/Unchase.Swashbuckle.AspNetCore.Extensions
Apache License 2.0
115 stars 16 forks source link

Multiple Enum Labels with the Same Value Results in Unusable Output #20

Closed Lazzaretti closed 1 year ago

Lazzaretti commented 2 years ago

I have an enum with multiple labels pointing to the same value.

public enum SomeFields
{
   Field1 = 1,
   AnotherNameForField1 = Field1,
   Field2 = 2,
}

Unfortunately, that results in a non-matchable list of values and names:

"SomeFields": {
  "enum": [
    1,
    2
  ],
  "type": "integer",
  "format": "int32",
  "x-enumNames": [
    "Field1",
    "AnotherNameForField1",
    "Field2"
  ]
},

Can that be fixed by eighter: duplicate the enum values (enum), or remove the duplicate labels from the labels list (x-enumNames)?