-
-
Notifications
You must be signed in to change notification settings - Fork 227
Adding support for named integer enums #1214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've resisted adding custom OpenAPI attributes just for this generator... ideally, we could adopt conventions used by more popular projects, like OpenAPITools. Is |
Yes, OpenAPITools adopted it in this PR -> OpenAPITools/openapi-generator#917 I did also search around for any other official or even adopted standard for this but came up empty. |
…the values length
Just fixed the possible null reference that failed tests. Also added a sanity check to ensure the lengths of the |
# Conflicts: # tests/test_parser/test_properties/test_init.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! In addition to the one thought below, could you add something to the README about this feature? It's kinda the only docs we have right now 😓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go. We should come up with a way to emit warnings effectively that don't stop code from being generated, but that needs some broader thinking outside this change.
> [!IMPORTANT] > Merging this pull request will create this release ## Features ### Adding support for named integer enums #1214 by @barrybarrette Adding support for named integer enums via an optional extension, `x-enum-varnames`. This extension is added to the schema inline with the `enum` definition: ``` "MyEnum": { "enum": [ 0, 1, 2, 3, 4, 5, 6, 99 ], "type": "integer", "format": "int32", "x-enum-varnames": [ "Deinstalled", "Installed", "Upcoming_Site", "Lab_Site", "Pending_Deinstall", "Suspended", "Install_In_Progress", "Unknown" ] } ``` The result:  Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
Adding support for named enums via an optional extension,
x-enum-varnames
.This extension is added to the schema inline with the
enum
definition:The result:
