@@ -39,35 +39,37 @@ def validate(
39
39
* ,
40
40
level : ValidationLevel ,
41
41
workflow_definition : dict [str , Any ],
42
- workflow_inputs : dict [str , Any ] | None = None ,
42
+ variables : dict [str , Any ] | None = None ,
43
43
) -> ValidationResult :
44
44
"""Validates the workflow definition (and inputs)
45
45
based on the provided 'level'."""
46
46
assert level in ValidationLevel
47
47
assert isinstance (workflow_definition , dict )
48
- if workflow_inputs :
49
- assert isinstance (workflow_inputs , dict )
48
+ if variables :
49
+ assert isinstance (variables , dict )
50
50
51
- # ALl levels require a schema validation
51
+ # ALl levels need to pass schema validation
52
52
if error := validate_schema (workflow_definition ):
53
53
return ValidationResult (error_num = 1 , error_msg = [error ])
54
54
55
+ # Now level-specific validation...
55
56
if level == ValidationLevel .RUN :
56
57
run_level_result : ValidationResult = WorkflowValidator ._validate_run_level (
57
58
workflow_definition = workflow_definition ,
58
- workflow_inputs = workflow_inputs ,
59
+ variables = variables ,
59
60
)
60
61
if run_level_result .error_num :
61
62
return run_level_result
62
63
64
+ # OK if we get here
63
65
return _VALIDATION_SUCCESS
64
66
65
67
@classmethod
66
68
def _validate_run_level (
67
69
cls ,
68
70
* ,
69
71
workflow_definition : dict [str , Any ],
70
- workflow_inputs : dict [str , Any ] | None = None ,
72
+ variables : dict [str , Any ] | None = None ,
71
73
) -> ValidationResult :
72
74
assert workflow_definition
73
75
@@ -107,7 +109,7 @@ def _validate_run_level(
107
109
wf_variables : list [str ] = get_variable_names (workflow_definition )
108
110
missing_values : list [str ] = []
109
111
for wf_variable in wf_variables :
110
- if not workflow_inputs or wf_variable not in workflow_inputs :
112
+ if not variables or wf_variable not in variables :
111
113
missing_values .append (wf_variable )
112
114
if missing_values :
113
115
return ValidationResult (
0 commit comments