marshmallow_union package¶
Module contents¶
Union fields for marshmallow.
- exception marshmallow_union.ExceptionGroup(msg, errors)[source]¶
Bases:
marshmallow_union.MarshmallowUnionExceptionCollection of possibly multiple exceptions.
- exception marshmallow_union.MarshmallowUnionException[source]¶
Bases:
ExceptionBase exception for marshmallow_union.
- class marshmallow_union.Union(fields, reverse_serialize_candidates=False, **kwargs)[source]¶
Bases:
marshmallow.fields.FieldField that accepts any one of multiple fields.
Each argument will be tried until one succeeds.
- Parameters
fields (
List[Field]) – The list of candidate fields to try.reverse_serialize_candidates (
bool) – Whether to try the candidates in reverse order when serializing.