Skip to content

Commit

Permalink
Fix list sub-type type resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredoconnell committed Nov 8, 2024
1 parent 6dcecbd commit 5d0f2da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/arcaflow_plugin_sdk/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6787,12 +6787,14 @@ def _resolve_list_annotation(
"List type without item type definition encountered, please"
" declare your lists like this: typing.List[str]",
)
sub_type = args[0]

new_path = list(path)
new_path.append("items")
try:
return ListType(
cls._resolve_abstract_type(
args[0], type_hints, tuple(new_path), scope
sub_type, sub_type, tuple(new_path), scope
)
)
except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions src/arcaflow_plugin_sdk/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ class TestData1:
default="", metadata={"id": "test-field", "name": "G"}
)
I: typing.Any = None
J: typing.List[typing.Dict[str, str]] = dataclasses.field(default_factory=list)

schema.test_object_serialization(
TestData1(A="Hello world!", B=5, C={}, D=[], H=3.14),
Expand Down

0 comments on commit 5d0f2da

Please sign in to comment.