File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,39 @@ content_type_overrides:
192
192
application/zip: application/octet-stream
193
193
` ` `
194
194
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
+
195
228
[changelog.md]: CHANGELOG.md
196
229
[poetry]: https://python-poetry.org/
197
230
[PDM]: https://pdm-project.org/latest/
You can’t perform that action at this time.
0 commit comments