Skip to main content

is_union_of_base_models

Check if field type is a Union where all members are BaseModel subclasses.

def is_union_of_base_models(
field_type: Any
) - > bool

Check if field type is a Union where all members are BaseModel subclasses.

Parameters

NameTypeDescription
field_typeAnyThe type hint to check, which could be a Union or any other type.

Returns

TypeDescription
boolTrue if the field type is a Union and all its members are subclasses of BaseModel, False otherwise.