Skip to content

Commit 3a8df57

Browse files
author
Barry Barrette
committed
Updating README.md
1 parent 130bab8 commit 3a8df57

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,39 @@ content_type_overrides:
192192
application/zip: application/octet-stream
193193
```
194194

195+
## Supported Extensions
196+
197+
### x-enum-varnames
198+
199+
This extension has been adopted by similar projects such as [OpenAPI Tools](https://github.com/OpenAPITools/openapi-generator/pull/917).
200+
It is intended to provide user-friendly names for integer Enum members that get generated.
201+
It is critical that the length of the array matches that of the enum values.
202+
203+
```
204+
"Colors": {
205+
"type": "integer",
206+
"format": "int32",
207+
"enum": [
208+
0,
209+
1,
210+
2
211+
],
212+
"x-enum-varnames": [
213+
"Red",
214+
"Green",
215+
"Blue"
216+
]
217+
}
218+
```
219+
220+
Results in:
221+
```
222+
class Color(IntEnum):
223+
RED = 0
224+
GREEN = 1
225+
BLUE = 2
226+
```
227+
195228
[changelog.md]: CHANGELOG.md
196229
[poetry]: https://python-poetry.org/
197230
[PDM]: https://pdm-project.org/latest/

0 commit comments

Comments
 (0)