You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is not that easy, since it adds a new dependency, which is also reflected to the python package. This can be avoided, if the enums would be declared as an extra.
My issue just was about enabling developers to create custom type mappings without modifying global configurations. Enums can be supplied using many different ways, the package I'm using is not the only possibility to create enum support.
On the other hand, please not, that the standard JSONEncoder in Python does not support enums as well an must be extended manually.
So, using Python enums is not that easy as it seems
Hey there,
I'm using marshmallow in combination with data class extension by @lovasoa and the enum extension by @justanr to create a json schema from my data class.
Unfortunately, this does not work out of the box. The JSON Schema runs into errors when building the schema.
So I derived it to a EnumSupportingJSONSchema like this.
This works fine. Unfortunately the ruby-like part where I extend the singleton class looks crappy.
What I would like to suggest is to use a per-instance dictionary of maps, which is initialized from the global dictionaries.
This way, it would be possible to sub-class this this way:
This way, the mapping would be only for the current instance and the JSONSchema is not "poisoned" by using optional values.
What do you think of my suggestion?
The text was updated successfully, but these errors were encountered: