diff --git a/src/python_workflow_definition/models.py b/src/python_workflow_definition/models.py index 8b25be8..c78dc73 100644 --- a/src/python_workflow_definition/models.py +++ b/src/python_workflow_definition/models.py @@ -28,6 +28,11 @@ "PythonWorkflowDefinitionWorkflow", ) +JsonPrimitive = Union[str, int, float, bool, None] +AllowableDefaults = TypeAliasType( + "AllowableDefaults", "Union[JsonPrimitive, tuple[AllowableDefaults, ...]]" +) + JsonPrimitive = Union[str, int, float, bool, None] AllowableDefaults = TypeAliasType( diff --git a/tests/test_models.py b/tests/test_models.py index d353f46..c3c1e65 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -53,8 +53,8 @@ def test_input_node_valid_values(self): "string", True, None, - [1, 2], - [["recursive", "tuple"], [True, False]], + (1, 2), + (("recursive", "tuple"), (True, False)), ) for value in good_values: with self.subTest(value=value): @@ -73,9 +73,10 @@ def test_input_node_valid_values(self): ).value ) + def test_input_node_invalid_value_raises(self): bad_values = ( - {1: 2}, + {"mutable": "thing"}, _NoTrivialSerialization(), ) for value in bad_values: