Skip to content

Commit

Permalink
Rename is_valid to check_children, because outputting a validity warn…
Browse files Browse the repository at this point in the history
…ing for every field with non-valid sub-fields does not make any sense and clutters up the warning output.

Signed-off-by: ClemensLinnhoff <clemens.linnhoff@partner.bmw.de>
  • Loading branch information
ClemensLinnhoff committed Mar 6, 2024
1 parent 5db143c commit ef8132c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion osivalidator/osi_general_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def process_timestep(timestep, data_type):
TIMESTAMP_ANALYZED.append(timestamp)

# Check common rules
getattr(rule_checker, "is_valid")(
getattr(rule_checker, "check_children")(
message, VALIDATION_RULES.get_rules().get_type(data_type)
)

Expand Down
6 changes: 3 additions & 3 deletions osivalidator/osi_rules_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def add_default_rules_to_subfields(message, type_rules):
)

if descriptor.message_type:
field_rules.add_rule(osi_rules.Rule(verb="is_valid"))
field_rules.add_rule(osi_rules.Rule(verb="check_children"))


# DECORATORS
Expand Down Expand Up @@ -92,7 +92,7 @@ def wrapper(self, field, rule, **kwargs):


@rule_implementation
def is_valid(self, field, rule):
def check_children(self, field, rule):
"""Check if a field message is valid, that is all the inner rules of the
message in the field are complying.
Expand Down Expand Up @@ -126,7 +126,7 @@ def is_valid(self, field, rule):
if not field.parent:
self.id_manager.resolve_unicity(self.timestamp)
self.id_manager.resolve_references(self.timestamp)
return True # TODO: workaround. Better: Do not iterate through subfields within a rule. Put this functionality in the general valiator.
return True


@rule_implementation
Expand Down

0 comments on commit ef8132c

Please sign in to comment.