connexion icon indicating copy to clipboard operation
connexion copied to clipboard

Enum type casting

Open Norbo11 opened this issue 5 years ago • 1 comments

I was very surprised to discover that connexion does not currently support type casting of swagger enum types to the python enum type (according to the docs and my own testing).

This is a feature request to support such casting.

type: string
enum: [value1. value2]
x-openapi-enum-class: myproject.mypackage.MyEnum

When I use the above parameter definition I would love to be able to receive MyEnum types as arguments to my controller functions. Even better, since we're specifying x-openapi-enum-class the enum values could be inferred without having to specify them twice.

Apologies if this is already supported and I somehow missed it.

Norbo11 avatar Jan 14 '20 18:01 Norbo11

Is anyone implementing this? Are the maintainers okay with adding this feature to Connexion? If no one is implementing this I would gladly submit a PR.

roo-oliv avatar Nov 10 '20 22:11 roo-oliv