Skip to content

Commit

Permalink
Fixing model datatype checks order
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schleemilch <[email protected]>
  • Loading branch information
sschleemilch authored and erikbosch committed Oct 23, 2024
1 parent 92d4873 commit c5ef757
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vss_tools/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit c5ef757

Please sign in to comment.