Skip to main content

model_ser_schema

Returns a schema for serialization using a model.

def model_ser_schema(
cls: type[Any],
schema: CoreSchema
) - > ModelSerSchema

Returns a schema for serialization using a model.

Parameters

NameTypeDescription
clstype[Any]The expected class type, used to generate warnings if the wrong type is passed during serialization
schemaCoreSchemaThe internal core schema used to define how the model's dictionary of data is serialized

Returns

TypeDescription
ModelSerSchemaA configuration object defining how a specific class type and its internal schema should be serialized.