Skip to main content

exclude_default

No overview available.

def exclude_default(
model: BaseModel,
data: dict
) - > dict

Filters out keys from a dictionary whose values match their defined default values in a Pydantic model.

Parameters

NameTypeDescription
modelBaseModelThe Pydantic model instance used to retrieve default field values for comparison.
datadictThe dictionary of data to be filtered by comparing against the model defaults.

Returns

TypeDescription
dictA dictionary containing only the fields that differ from the model's default values.