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
{{ message }}
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
I am also trying to use enum names instead of values (it would be a more sensible default, imo). The problem is that enums are handled as a special case in a different order for encode, decode, and schemas. A FieldEncoder works for encode and decode because the field encoders are checked before the enum special case. For schemas, the enum case is checked first, so any enum field encoder is never reached.
I think all that needs to change for this to work is to process the field encoders first in _get_field_schema. You would still need to register the encoder for each enum type. It would be great if there was a way to register a FieldEncoder for a type and all subtypes as well, but the field encoders would have to receive the subtype as an argument.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have an Enum where the numeric values are used internally, but the string values are used in the API calls.
I have solved this by using the FieldEncoder class. But it breaks when I call
from_dict
with validate=True.Seems to be because MyClass._field_encoders[field.type].json_schema is different than MyClass._get_field_schema(field, schema_options)
Example:
The text was updated successfully, but these errors were encountered: