swagger-api / swagger-api/swagger-codegen
[Python] Add function to get list of allowed enum vars
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
We have a lot of enums defined in our backend. We have a small UI that shows these enums as a dropdown. The problem we face is whenever we update the enums on our backend. We have to update the frontend code. If swagger codegen can provide the enum values as a list we can return that in an API for frontend to populate these values or use this function to render it in django forms.
For example:
Consider this class
It has enums placed, approved, delivered. But there is no way for me to get these values as a list at the moment.
Swagger-codegen version
2.4.8
Suggest a fix/enhancement
Add a function that returns the list of enum vars.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Python model shown in samples/client/petstore/python/petstore_api/models/outer_enum.py around lines 29–31, then trace the template or generator input that produces its enum definitions. Confirm how the allowed values should be exposed for generated models and add coverage for the outer_enum example. Done means callers can retrieve placed, approved, and delivered as a list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100