Closed ArjixWasTaken closed 1 year ago
Example enum:
{
"components": {
"schemas": {
"Role": {
"enum": [ 0, 1, 2, 3, 4 ],
"description": "xOx Enum description xOx",
"type": "integer",
"format": "int32",
"example": 0,
"x-enum-varnames": [
"SuperAdmin",
"Admin",
"Management",
"Doctor",
"Nurse"
],
"x-enum-descriptions": [
"The super admin.",
"The local admin.",
"The management.",
"A doctor.",
"A nurse."
]
}
}
}
}
Generated code
/**
* xOx Enum description xOx
*/
public enum class Role {
/**
* The super admin.
*/
@Json(name = "0")
SuperAdmin,
/**
* The local admin.
*/
@Json(name = "1")
Admin,
/**
* The management.
*/
@Json(name = "2")
Management,
/**
* A doctor.
*/
@Json(name = "3")
Doctor,
/**
* A nurse.
*/
@Json(name = "4")
Nurse,
}
I am not aware of any other enum spec extensions, if you know any others I'd be glad to include them in the PR.
Thanks a lot for your contribution! A great idea to add these extensions. Looks good from a first glance. I will have a detailed look as soon as I find the time.
Supported Extensions:
NSwag
x-enumNames
Redocly
x-enumDescriptions
OpenAPI-Generator
x-enum-varnames
x-enum-descriptions