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
| Attribute | Type | Description |
|---|---|---|
| SimpleDict | enum member | Represents a TypedDict with no extra items allowed. |
| ModelExtra | enum member | Represents a model that retrieves both dict and pydantic_extra where the GeneralFieldsSerializer receives a tuple. |
| TypedDictAllow | enum member | Represents 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.