Skip to main content

get_pydantic_serializer

No overview available.

def get_pydantic_serializer(
model_class: Type[BaseModel]
) - > Callable

Returns a Pydantic-based serializer function for a given model class, enabling efficient conversion of model instances into dictionaries.

Parameters

NameTypeDescription
model_classType[BaseModel]The Pydantic model class used to define the structure and validation rules for the serialization process.

Returns

TypeDescription
CallableA function that accepts a model instance and returns its dictionary representation based on the model's schema.