Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixing model datatype checks order #418

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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