Skip to content

Commit 2826d40

Browse files
author
Alan Christie
committed
feat: Decoder now offers get_required_variable_names()
1 parent 9026fec commit 2826d40

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

workflow/decoder.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,17 @@ def get_variable_names(definition: dict[str, Any]) -> list[str]:
7676
output_variable["name"] for output_variable in variables.get("outputs", [])
7777
)
7878
return wf_variable_names
79+
80+
81+
def get_required_variable_names(definition: dict[str, Any]) -> list[str]:
82+
"""Given a Workflow definition this function returns all the names of the
83+
variables that are required to be defined when it is RUN - i.e.
84+
all those the user needs to provide."""
85+
required_variables: list[str] = []
86+
variables: dict[str, Any] | None = definition.get("variables")
87+
if variables:
88+
# For now, all inputs are required...
89+
required_variables.extend(
90+
input_variable["name"] for input_variable in variables.get("inputs", [])
91+
)
92+
return required_variables

0 commit comments

Comments
 (0)