marshmallow_enum
marshmallow_enum copied to clipboard
Add metadata for apispec compatibility
fixes #24
This PR adds the key enum to the field's metadata which allows apispec (and possibly other tools) to extract the valid enum values.
It would be nice if we could get this merged. I am having troubles getting EnumField to work correctly currently with apispec.
TypeError: 'MyEnum' object is not subscriptable
Could you please merge this PR? We're also running into this same issue of being unable to export Enum values using apispec and marshmallow_dataclass. Would be fantastic to have this!
I added a fork (based on #25) that fixes this issue (while removing the load_by/dump_by ambiguity) at https://github.com/h/marshmallow_enum
This issue hasn't been merged since 2018 -- so if anyone else needs support for APISpec with marshmallow, simply run:
$ pip install -e git+https://github.com/h/marshmallow_enum#egg=marshmallow-enum