Skip to main content

SerializationState

This class manages the internal state of the serialization process, tracking configuration, recursion depth, and warning collection. It maintains context for the current model and field being processed while handling complex logic for union branch selection and field inclusion or exclusion rules.

Attributes

AttributeTypeDescription
warnings[CollectWarnings](collectwarnings.md?sid=serializers_extra_collectwarnings)A collection of warnings encountered during the serialization process to be reported back to the user.
rec_guard[RecursionState](../../recursion/guard/recursionstate.md?sid=recursion_guard_recursionstate)Manages the current recursion depth to prevent stack overflow errors during nested object serialization.
config[SerializationConfig](../config/serializationconfig.md?sid=serializers_config_serializationconfig)The configuration settings used to determine the behavior and formatting of the serialization output.
modelOption< Bound< 'py, PyAny > >The model currently being serialized, if any
field_nameOption< Bound< 'py, PyString > >The name of the field currently being serialized, if any
check[SerCheck](sercheck.md?sid=serializers_extra_sercheck)Inside unions, checks are applied to attempt to select a preferred branch
include_excludeIncludeExclude< 'py >Defines the set of fields to be included or excluded from the final serialized output.
extraExtra< 'py >Global settings for the serialization process