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 have many schemas which have some list fields, and I want all my list fields in my schemas have a feature, that is load a None into [] automatically. So when I operate with advanced class object, I don't need to worry about it is a None or a list.
This feature cannot be simply implemented by override _deserialize, because _deserialize will not be called if input value is None. (but _serialize will be called if attribute value is None, which is different behavior as _deserialize)
One way to implement this feature, is to add @post_load to each Schama, which needs lot of repeat code.
Another way to solve the problem, is to override deserialize in fields.List, which is not the recommended way to subclass Field
I have many schemas which have some list fields, and I want all my list fields in my schemas have a feature, that is load a
None
into[]
automatically. So when I operate with advanced class object, I don't need to worry about it is aNone
or alist
.This feature cannot be simply implemented by override
_deserialize
, because_deserialize
will not be called if input value isNone
. (but_serialize
will be called if attribute value isNone
, which is different behavior as_deserialize
)One way to implement this feature, is to add
@post_load
to each Schama, which needs lot of repeat code.Another way to solve the problem, is to override
deserialize
infields.List
, which is not the recommended way to subclassField
The text was updated successfully, but these errors were encountered: