|
|
|
@ -183,3 +183,18 @@ def is_uploadfile_sequence_annotation(annotation: Any) -> bool: |
|
|
|
is_uploadfile_or_nonable_uploadfile_annotation(sub_annotation) |
|
|
|
for sub_annotation in get_args(annotation) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def annotation_is_pydantic_v1(annotation: Any) -> bool: |
|
|
|
if lenient_issubclass(annotation, v1.BaseModel): |
|
|
|
return True |
|
|
|
origin = get_origin(annotation) |
|
|
|
if origin is Union or origin is UnionType: |
|
|
|
for arg in get_args(annotation): |
|
|
|
if lenient_issubclass(arg, v1.BaseModel): |
|
|
|
return True |
|
|
|
if field_annotation_is_sequence(annotation): |
|
|
|
for sub_annotation in get_args(annotation): |
|
|
|
if annotation_is_pydantic_v1(sub_annotation): |
|
|
|
return True |
|
|
|
return False |
|
|
|
|