<#5473 [BUG] nested dynamic won't bind pydantic mo...
# flytekit
c
#5473 [BUG] nested dynamic won't bind pydantic models or dictionaries as inputs Issue created by linojaime Describe the bug if a nested dynamic task has a pydantic model or dict as an input it won't bind to the task The error when using pydantic is:
Copy code
[User] malformed dynamic workflow, caused by: Collected Errors: 10
	Error 0: Code: MismatchingBindings, Node Id: dn0, Description: Input [l] on node [dn0] expects bindings of type [simple:STRUCT].  Received []
When transform pydantic model into a dict the error is:
Copy code
TypeError: Failed to convert inputs of task 'flyte.workflows.test_wf.level2':
  'NoneType' object is not subscriptable
Expected behavior Pydantic models and dictionaries bind properly to the nested dynamic task Additional context to reproduce Pydantic: from typing import List from flytekit import ImageSpec, dynamic, workflow from pydantic.v1 import BaseModel class SModel(BaseModel): name: str @dynamic(container_image=pydantic_image) def level2(l: SModel) -> List[int]: return [1, 2, 3] @dynamic(container_image=pydantic_image) def level1(l: List[int]) -> str: v = [] for i in l: v.append(level2(l=SModel(name="a"))) return "test" @workflow def multi_wf(l: List[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -> str: return level1(l=l) Dict: from typing import List from flytekit import ImageSpec, dynamic, workflow from pydantic.v1 import BaseModel class SModel(BaseModel): name: str @dynamic(container_image=pydantic_image) def level2(l: dict) -> List[int]: return [1, 2, 3] @dynamic(container_image=pydantic_image) def level1(l: List[int]) -> str: v = [] for i in l: v.append(level2(l=SModel(name="a").dict())) return "test" @workflow def multi_wf(l: List[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -> str: return level1(l=l) Screenshots No response Are you sure this issue hasn't been raised already? • Yes Have you read the Code of Conduct? • Yes flyteorg/flyte