Skip to content

Commit

Permalink
When loading a ruleset that has features, run post_validate on them.
Browse files Browse the repository at this point in the history
  • Loading branch information
kw committed Mar 24, 2024
1 parent fa983b8 commit 03747fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/camp/engine/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def _parse_ruleset_dict(ruleset_dict: dict):
ruleset_model = utils.import_name(ruleset_def)
if not issubclass(ruleset_model, base_models.BaseRuleset):
raise ValueError(f"{ruleset_def} does not implement BaseRuleset")
return pydantic.TypeAdapter(ruleset_model).validate_python(ruleset_dict)
ruleset = pydantic.TypeAdapter(ruleset_model).validate_python(ruleset_dict)
for feature in ruleset.features.values():
feature.post_validate(ruleset)
return ruleset


def _parse_directory(
Expand Down

0 comments on commit 03747fb

Please sign in to comment.