diff --git a/src/openjd/model/v2023_09/_model.py b/src/openjd/model/v2023_09/_model.py index ad099d6..9189bbb 100644 --- a/src/openjd/model/v2023_09/_model.py +++ b/src/openjd/model/v2023_09/_model.py @@ -351,6 +351,9 @@ class EnvironmentActions(OpenJDModel_v2023_09): @classmethod def _requires_oneof(cls, values: dict[str, Any]) -> dict[str, Any]: """A validator that runs on the model data before parsing.""" + if not isinstance(values, dict): + raise ValueError("Expected a dictionary of values") + on_enter = values.get("onEnter") on_exit = values.get("onExit") if on_enter is None and on_exit is None: diff --git a/test/openjd/model/v2023_09/test_template_variables.py b/test/openjd/model/v2023_09/test_template_variables.py index d01133f..2e6f43a 100644 --- a/test/openjd/model/v2023_09/test_template_variables.py +++ b/test/openjd/model/v2023_09/test_template_variables.py @@ -1128,6 +1128,17 @@ def test_job_template_variables_parse_success(data: dict[str, Any]) -> None: 2, # Validation of Job Foo & Task Foo id="all parameter symbols are defined when validation errors", ), + pytest.param( + { + "specificationVersion": "jobtemplate-2023-09", + "name": "Foo", + "parameterDefinitions": [FOO_PARAMETER_STRING], + "steps": [STEP_TEMPLATE_FOO], + "jobEnvironments": [{"name": "VariableEnv", "script": {"actions": []}}], + }, + 1, + id="jobEnvironments.script.actions needs to be a dict", + ), )