I have the following enum in c#
public enum ErrorCodes: int {
[Display(Name = "Nothing", Order = 1)]
None = 0,
[Display(Name = "Already Exists", Order = 2)]
AlreadyExists = 1,
...
[Display(Name = "Teapot", Order = 99)]
Teapot = int.MaxValue
}
that generates the following swagger for the enum:
"ErrorCodes": {
"enum": [
0,
1,
...
2147483647
],
"x-enumNames": [
"None",
"AlreadyExists"
...
"Teapot"
],
"x-enumDisplayNames]: [
"Nothing",
"Already Exists"
...
"Teapot"
]
}
When I the nswag cli for the file it generates:
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.3.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public enum ErrorCodes
{
None = 0,
AlreadyExists = 1,
Teapot = 2147483647,
}
The swagger UI UI displays the integer value, not the string and the client does not handle the display name (as expected).
Using the nswag cli, how can I have it process the enum and generate it with the DisplayAttribute?