|
def | __init__ (self, typing.Optional[typing.Union[typing.Callable[[typing.Any], typing.Any], typing.Callable[[typing.Any, typing.Dict], typing.Any],]] serialize=None, typing.Optional[typing.Union[typing.Callable[[typing.Any], typing.Any], typing.Callable[[typing.Any, typing.Dict], typing.Any],]] deserialize=None, **kwargs) |
|
None | __init__ (self, *typing.Any default=missing_, typing.Any missing=missing_, typing.Optional[str] data_key=None, typing.Optional[str] attribute=None, typing.Optional[typing.Union[typing.Callable[[typing.Any], typing.Any], typing.Iterable[typing.Callable[[typing.Any], typing.Any]],]] validate=None, bool required=False, typing.Optional[bool] allow_none=None, bool load_only=False, bool dump_only=False, typing.Optional[typing.Dict[str, str]] error_messages=None, typing.Optional[typing.Mapping[str, typing.Any]] metadata=None, **additional_metadata) |
|
str | __repr__ (self) |
|
def | __deepcopy__ (self, memo) |
|
def | get_value (self, obj, attr, accessor=None, default=missing_) |
|
ValidationError | make_error (self, str key, **kwargs) |
|
def | fail (self, str key, **kwargs) |
|
def | serialize (self, str attr, typing.Any obj, typing.Optional[typing.Callable[[typing.Any, str, typing.Any], typing.Any]] accessor=None, **kwargs) |
|
def | deserialize (self, typing.Any value, typing.Optional[str] attr=None, typing.Optional[typing.Mapping[str, typing.Any]] data=None, **kwargs) |
|
def | context (self) |
|
def | serialize (self, attr, obj, accessor=None) |
|
def | deserialize (self, value) |
|
A field that takes the value returned by a function.
:param serialize: A callable from which to retrieve the value.
The function must take a single argument ``obj`` which is the object
to be serialized. It can also optionally take a ``context`` argument,
which is a dictionary of context variables passed to the serializer.
If no callable is provided then the ```load_only``` flag will be set
to True.
:param deserialize: A callable from which to retrieve the value.
The function must take a single argument ``value`` which is the value
to be deserialized. It can also optionally take a ``context`` argument,
which is a dictionary of context variables passed to the deserializer.
If no callable is provided then ```value``` will be passed through
unchanged.
.. versionchanged:: 2.3.0
Deprecated ``func`` parameter in favor of ``serialize``.
.. versionchanged:: 3.0.0a1
Removed ``func`` parameter.