File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/eligibility_signposting_api/model Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,17 @@ def validate_attribute_name_is_optional_only_for_cohort_attribute_level(self) -
171171 if self .attribute_level == RuleAttributeLevel .COHORT :
172172 return self
173173 else :
174- raise ValueError (f"AttributeName must be set for { self .attribute_level } AttributeLevel." )
174+ raise ValueError (f"AttributeName must be set where AttributeLevel is { self .attribute_level } ." )
175+
176+ @model_validator (mode = "after" )
177+ def validate_attribute_target_is_mandatory_for_target_attribute_level (self ) -> typing .Self : # noqa: N805
178+ if self .attribute_target :
179+ return self
180+ else :
181+ if self .attribute_level != RuleAttributeLevel .TARGET :
182+ return self
183+ else :
184+ raise ValueError (f"AttributeTarget is mandatory where AttributeLevel is { self .attribute_level } ." )
175185
176186
177187 _parent : Iteration | None = PrivateAttr (default = None )
You can’t perform that action at this time.
0 commit comments