Skip to content

Commit

Permalink
Add description attribute to SecretOrVariable and update XSD schema
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed Nov 28, 2024
1 parent afecee8 commit 15f112f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/galaxy/tool_util/deps/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,19 @@ def resource_requirements_from_list(requirements: Iterable[Dict[str, Any]]) -> L


class SecretOrVariable:
def __init__(self, type: str, name: str, inject_as_env: str, label: str = "") -> None:
def __init__(
self,
type: str,
name: str,
inject_as_env: str,
label: str = "",
description: str = "",
) -> None:
self.type = type
self.name = name
self.inject_as_env = inject_as_env
self.label = label
self.description = description
if self.type not in {"secret", "variable"}:
raise ValueError(f"Invalid credential type '{self.type}'")
if not self.inject_as_env:
Expand All @@ -323,6 +331,7 @@ def to_dict(self) -> Dict[str, Any]:
"name": self.name,
"inject_as_env": self.inject_as_env,
"label": self.label,
"description": self.description,
}

@classmethod
Expand All @@ -332,6 +341,7 @@ def from_element(cls, elem) -> "SecretOrVariable":
name=elem.get("name"),
inject_as_env=elem.get("inject_as_env"),
label=elem.get("label", ""),
description=elem.get("description", ""),
)

@classmethod
Expand All @@ -340,7 +350,8 @@ def from_dict(cls, dict: Dict[str, Any]) -> "SecretOrVariable":
name = dict["name"]
inject_as_env = dict["inject_as_env"]
label = dict.get("label", "")
return cls(type=type, name=name, inject_as_env=inject_as_env, label=label)
description = dict.get("description", "")
return cls(type=type, name=name, inject_as_env=inject_as_env, label=label, description=description)


class CredentialsRequirement:
Expand Down
10 changes: 10 additions & 0 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,11 @@ environment of the tool process as an environment variable.
<xs:documentation xml:lang="en">The label for the variable.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="description" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">The description for the variable.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="CredentialsSecret">
<xs:annotation>
Expand All @@ -821,6 +826,11 @@ environment of the tool process as an environment variable.
<xs:documentation xml:lang="en">The label for the secret.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="description" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">The description for the secret.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:simpleType name="HelpFormatType">
<xs:annotation>
Expand Down

0 comments on commit 15f112f

Please sign in to comment.