Skip to content

Commit

Permalink
Adding validation to cover all extract_fields paths
Browse files Browse the repository at this point in the history
  • Loading branch information
skrawcz committed Dec 12, 2024
1 parent c34bd44 commit 1e7e136
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hamilton/function_modifiers/expanders.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ def validate(self, fn: Callable):
elif typing_extensions.is_typeddict(output_type):
if self.fields is None:
self.fields = typing.get_type_hints(output_type)
_validate_extract_fields(self.fields)
else:
# check that fields is a subset of TypedDict that is defined
typed_dict_fields = typing.get_type_hints(output_type)
Expand All @@ -778,6 +777,7 @@ def validate(self, fn: Callable):
raise base.InvalidDecoratorException(
f"Error {self.fields} did not match a subset of the TypedDict annotation's fields {typed_dict_fields}."
)
_validate_extract_fields(self.fields)
else:
raise base.InvalidDecoratorException(
f"For extracting fields, output type must be a dict or typing.Dict, not: {output_type}"
Expand Down

0 comments on commit 1e7e136

Please sign in to comment.