From 74c12eb086eda1e28cbe63e2c2141434dd819f54 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 7 Sep 2024 18:34:32 +0200 Subject: [PATCH] Allow setting default value for required parameter --- lib/galaxy/workflow/modules.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 24f87542f8f6..17dedfac69e8 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -1258,12 +1258,15 @@ def get_inputs(self): when_true = ConditionalWhen() when_true.value = "true" - when_true.inputs = {} - when_true.inputs["default"] = specify_default_cond + when_true.inputs = {"default": specify_default_cond} when_false = ConditionalWhen() when_false.value = "false" - when_false.inputs = {} + # This is only present for backwards compatibility, + # We don't need this conditional since you can set + # a default value for optional and required parameters. + # TODO: version the state and upgrade it to a simpler version + when_false.inputs = {"default": specify_default_cond} optional_cases = [when_true, when_false] optional_cond.cases = optional_cases @@ -1588,7 +1591,6 @@ def step_state_to_tool_state(self, state): if "default" in state: default_set = True default_value = state["default"] - state["optional"] = True multiple = state.get("multiple") validators = state.get("validators") restrictions = state.get("restrictions")