From 28a921ec8345e3c31e53dccc3fd1ba69e9ddc41d Mon Sep 17 00:00:00 2001 From: Sebastian Schleemilch Date: Wed, 23 Oct 2024 14:23:00 +0200 Subject: [PATCH] Fixing model datatype checks order Signed-off-by: Sebastian Schleemilch --- src/vss_tools/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vss_tools/model.py b/src/vss_tools/model.py index 0060c6e9..b25bd886 100644 --- a/src/vss_tools/model.py +++ b/src/vss_tools/model.py @@ -192,7 +192,6 @@ def check_type_arraysize_consistency(self) -> Self: assert is_array(self.datatype), f"'arraysize' set on a non array datatype: '{self.datatype}'" return self - @model_validator(mode="after") def check_type_default_consistency(self) -> Self: """ Checks that the default value @@ -230,7 +229,6 @@ def check_default_values_allowed(self) -> Self: assert v in self.allowed, f"default value '{v}' is not in 'allowed' list" return self - @model_validator(mode="after") def check_allowed_datatype_consistency(self) -> Self: """ Checks that allowed values are valid @@ -254,6 +252,8 @@ def check_allowed_min_max(self) -> Self: def check_datatype(self) -> Self: assert self.datatype in get_all_datatypes(self.fqn), f"'{self.datatype}' is not a valid datatype" self.datatype = resolve_datatype(self.datatype, self.fqn) + self.check_type_default_consistency() + self.check_allowed_datatype_consistency() return self @field_validator("unit")