Skip to content

Commit

Permalink
Clarify behavior around unspecified hidden parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Aug 9, 2024
1 parent f3a94c5 commit 250b60b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/galaxy/tool_util/parameters/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ def _from_input_source_galaxy(input_source: InputSource) -> ToolParameterT:
)
elif param_type == "hidden":
optional = input_source.parse_optional()
value = input_source.get("value")
return HiddenParameterModel(
name=input_source.parse_name(),
optional=optional,
value=value,
)
elif param_type == "color":
optional = input_source.parse_optional()
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/tool_util/parameters/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def request_requires_value(self) -> bool:

class HiddenParameterModel(BaseGalaxyToolParameterModelDefinition):
parameter_type: Literal["gx_hidden"] = "gx_hidden"
value: Optional[str]

@property
def py_type(self) -> Type:
Expand All @@ -356,7 +357,7 @@ def pydantic_template(self, state_representation: StateRepresentationT) -> Dynam

@property
def request_requires_value(self) -> bool:
return not self.optional
return not self.optional and self.value is None


def ensure_color_valid(value: Optional[Any]):
Expand Down
2 changes: 2 additions & 0 deletions test/unit/tool_util/parameter_specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ gx_hidden:
- parameter: moocow
- parameter: 'some spaces'
- parameter: ''
# it will use a default if value is set in definition and no value supplied (see hidden_param.xml)
- {}
request_invalid:
- parameter: null
- parameter: 5
Expand Down

0 comments on commit 250b60b

Please sign in to comment.