Skip to content

Commit f0bd568

Browse files
committed
Adding validation to cover all extract_fields paths
1 parent 1782dcf commit f0bd568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hamilton/function_modifiers/expanders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,6 @@ def validate(self, fn: Callable):
769769
elif typing_extensions.is_typeddict(output_type):
770770
if self.fields is None:
771771
self.fields = typing.get_type_hints(output_type)
772-
_validate_extract_fields(self.fields)
773772
else:
774773
# check that fields is a subset of TypedDict that is defined
775774
typed_dict_fields = typing.get_type_hints(output_type)
@@ -778,6 +777,7 @@ def validate(self, fn: Callable):
778777
raise base.InvalidDecoratorException(
779778
f"Error {self.fields} did not match a subset of the TypedDict annotation's fields {typed_dict_fields}."
780779
)
780+
_validate_extract_fields(self.fields)
781781
else:
782782
raise base.InvalidDecoratorException(
783783
f"For extracting fields, output type must be a dict or typing.Dict, not: {output_type}"

0 commit comments

Comments
 (0)