Skip to content

Commit

Permalink
Allow setting default value for required parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Sep 7, 2024
1 parent a393cc8 commit 74c12eb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/galaxy/workflow/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 74c12eb

Please sign in to comment.