I would like to generate a swagger-json containing an enum. My problem is the way the enum gets rendered:
"MyEnumType": {
"typeName": "MyEnumType",
"type": "string",
"enum": [
"first",
"second",
"third"
]
}
What I really want is the name of the possible values (first, second, third) as well as the value behind that enum-values (0, 1, 2). Is it even possible to generate such a json (which is "swagger-valid") and if so, how?
I use NSwag and in the meantime Rico Suter from NSwag made the feature available. Big props to him!
The current version of the OpenAPI (fka. Swagger) do not propose this. It will probably be added in next version (cf. https://github.com/OAI/OpenAPI-Specification/issues/348)
In the meanwhile having the same issue I ended giving these informations in the property's description.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With