diff --git a/mistral/lang/v2/workflows.py b/mistral/lang/v2/workflows.py index 6fa7855c8..e4981ec23 100644 --- a/mistral/lang/v2/workflows.py +++ b/mistral/lang/v2/workflows.py @@ -38,7 +38,8 @@ class WorkflowSpec(base.BaseSpec): "input": types.UNIQUE_STRING_OR_ONE_KEY_DICT_LIST, "output": types.NONEMPTY_DICT, "output-on-error": types.NONEMPTY_DICT, - "vars": types.NONEMPTY_DICT + "vars": types.NONEMPTY_DICT, + "tags": types.UNIQUE_STRING_LIST }, "required": ["tasks"], "additionalProperties": False diff --git a/mistral/tests/unit/lang/v2/test_workflows.py b/mistral/tests/unit/lang/v2/test_workflows.py index a0301c5b2..e5027ab70 100644 --- a/mistral/tests/unit/lang/v2/test_workflows.py +++ b/mistral/tests/unit/lang/v2/test_workflows.py @@ -425,3 +425,22 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase): "Workflow name cannot be in the format of UUID", str(exception) ) + + def test_tags(self): + tests = [ + ({'tags': ''}, True), + ({'tags': []}, True), + ({'tags': ['']}, True), + ({'tags': ['tag']}, False), + ({'tags': ['tag', 'tag']}, True), + ({'tags': None}, True) + ] + + for wf_tags, expect_error in tests: + overlay = {'test': wf_tags} + + self._parse_dsl_spec( + add_tasks=True, + changes=overlay, + expect_error=expect_error + )