Skip to content

Commit eba7856

Browse files
committedApr 23, 2025
fix(pydantic v1): more robust ModelField.annotation check
1 parent 7351b12 commit eba7856

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/openai/_models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
651651
# Note: if one variant defines an alias then they all should
652652
discriminator_alias = field_info.alias
653653

654-
if (annotation := getattr(field_info, 'annotation', None)) and is_literal_type(annotation):
654+
if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation):
655655
for entry in get_args(annotation):
656656
if isinstance(entry, str):
657657
mapping[entry] = variant

0 commit comments

Comments
 (0)