diff --git a/src/sophios/api/utils/ict/ict_spec/cast.py b/src/sophios/api/utils/ict/ict_spec/cast.py index 7225223a..89b2f687 100644 --- a/src/sophios/api/utils/ict/ict_spec/cast.py +++ b/src/sophios/api/utils/ict/ict_spec/cast.py @@ -7,23 +7,6 @@ from sophios.api.utils.ict.ict_spec.model import ICT -def remove_invalid_keys(ict_data: dict) -> None: - """remove invalid keys from "ui""" - - if ("ui" in ict_data): - - ui_list = ict_data["ui"] - - # ensure ui is correct data type according to ICT schema - if (not isinstance(ui_list, list)): - raise RuntimeError("Error: ui must be a list in ICT data.") - - # remove incorrect keys - for ui in ui_list: - ui.pop("format", None) - ui.pop("required", None) - - def cast_to_ict(ict: Union[Path, str, dict]) -> ICT: if isinstance(ict, str): @@ -40,10 +23,10 @@ def cast_to_ict(ict: Union[Path, str, dict]) -> ICT: else: raise ValueError(f"File extension not supported: {ict}") - remove_invalid_keys(data) + data.pop("ui", None) return ICT(**data) - remove_invalid_keys(ict) + ict.pop("ui", None) return ICT(**ict) diff --git a/src/sophios/api/utils/ict/ict_spec/model.py b/src/sophios/api/utils/ict/ict_spec/model.py index 42609045..bd1c8c01 100644 --- a/src/sophios/api/utils/ict/ict_spec/model.py +++ b/src/sophios/api/utils/ict/ict_spec/model.py @@ -24,7 +24,7 @@ class ICT(Metadata): inputs: list[IO] outputs: list[IO] - ui: list[UIItem] + ui: Optional[list[UIItem]] hardware: Optional[HardwareRequirements] = None @model_validator(mode="after")