Skip to main content

FieldsMode

This enum defines the different modes for handling fields during serialization, specifically distinguishing between simple dictionaries, models with extra attributes, and TypedDicts that allow additional items.

Attributes

AttributeTypeDescription
SimpleDictenum memberRepresents a TypedDict with no extra items allowed.
ModelExtraenum memberRepresents a model that retrieves both dict and pydantic_extra where the GeneralFieldsSerializer receives a tuple.
TypedDictAllowenum memberRepresents a TypedDict that allows extra items stored within a single dictionary.

Methods


SimpleDict()

def SimpleDict()

Represents a TypedDict with no extra items allowed, ensuring strict adherence to defined keys.


ModelExtra()

def ModelExtra()

Represents a Pydantic model where both the standard dictionary and extra fields are extracted, typically resulting in a tuple for the serializer.


TypedDictAllow()

def TypedDictAllow()

Represents a TypedDict that permits extra items, resulting in a single dictionary containing both defined and additional fields.