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 the structure and serialization logic of the model's dictionary

Returns

TypeDescription
ModelSerSchemaA configuration object defining how a model class and its internal schema should be serialized