Skip to main content

serialization_exclude_if

No overview available.

def serialization_exclude_if(
predicate: Callable[[Any], bool]
) - > Callable

Returns a decorator that conditionally excludes a field from serialization based on a predicate function.

Parameters

NameTypeDescription
predicateCallable[[Any], bool]A function that receives the field value and returns True if the field should be omitted from the serialized output.

Returns

TypeDescription
CallableA decorator function that attaches the exclusion predicate to the target field's metadata.