openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

Add literals alongside enums

Open theorm opened this issue 11 months ago • 2 comments

Generating literal types alongside string and int Enums. We really need it in our code so have this in our custom templates. I thought there are others who would like to have it in the default template.

theorm avatar Mar 29 '24 12:03 theorm

Are you using literals instead of enums? Is there a particular limitation of enums that makes that necessary? Trying to understand if this should be an option in config (to generate literals instead) or if it makes sense to completely replace enums with literals 🤔

dbanty avatar Apr 19 '24 22:04 dbanty

We are using literals instead of enums in a public library with a lot of choice parameters where having enums would mean a lot of typing for the user and generally more noise in the code. There are still many developers out there who prefer to use enums instead of literals, so making it configurable would be a much better option!

theorm avatar Apr 27 '24 21:04 theorm

Replaced by https://github.com/openapi-generators/openapi-python-client/pull/1076

theorm avatar Jul 19 '24 13:07 theorm