<#1257 add CLI JSON parsing for File, Dir, and Dat...
# flyte-github
a
#1257 add CLI JSON parsing for File, Dir, and DataFrame in collections Pull request opened by cosmicBboy This pull request refactors and extends the logic for converting CLI parameter values to Python types in the Flyte CLI, with a focus on better handling of complex types such as dataclasses, lists, dicts, and special Flyte IO types (
File
,
Dir
,
DataFrame
). The main improvements include more robust type unwrapping, recursive conversion of nested structures, and support for Pydantic models. Type handling and conversion improvements: • Introduced
_unwrap_field_type
to recursively resolve underlying types, especially for handling `Optional`/`Union` types, ensuring correct type conversion throughout the code. • Refactored blob parameter conversion: replaced
_make_string_blob_converter
with
_convert_blob_value
, which now supports direct conversion of
File
,
Dir
, and
DataFrame
objects, and integrates with Pydantic models. • Added
_convert_blob_collection_elements
and
_convert_blob_fields_in_value
to recursively convert elements in lists, dicts, and dataclasses, ensuring nested structures are properly handled. Dataclass and collection instantiation: • Implemented
_instantiate_dataclass
to recursively construct dataclass instances from dictionaries, including handling of nested dataclasses in lists and dicts. • Updated the main
convert
method to use the new recursive conversion and instantiation logic for lists, dicts, and dataclasses, improving correctness and flexibility for complex parameter types. Other improvements: • Added import of
DataFrame
from
flyte.io
to support new conversion logic. These changes make parameter parsing more robust and extensible, especially for workflows using complex/nested types and Flyte-specific IO objects. flyteorg/flyte-sdk