File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def check_only_one_field(self) -> ConversionFieldValue:
3636 fields = [self .attribute_value , self .peer_id , self .peers_ids ]
3737 set_fields = [f for f in fields if f is not None ]
3838 if len (set_fields ) != 1 :
39- raise ValueError ("Exactly one of attribute_value, peer_id, or peers_ids must be set" )
39+ raise ValueError ("Exactly one of ` attribute_value`, ` peer_id` , or ` peers_ids` must be set" )
4040 return self
4141
4242
@@ -50,11 +50,11 @@ class ConversionFieldInput(BaseModel):
5050
5151 source_field : str | None = None
5252 data : ConversionFieldValue | None = None
53+ use_default_value : bool = False
5354
5455 @model_validator (mode = "after" )
5556 def check_only_one_field (self ) -> ConversionFieldInput :
56- if self .source_field is not None and self .data is not None :
57- raise ValueError ("Only one of source_field or data can be set" )
58- if self .source_field is None and self .data is None :
59- raise ValueError ("Either source_field or data must be set" )
57+ fields_set = [self .source_field is not None , self .data is not None , self .use_default_value is True ]
58+ if sum (fields_set ) != 1 :
59+ raise ValueError ("Exactly one of `source_field`, `data` or `use_default_value` must be set" )
6060 return self
You can’t perform that action at this time.
0 commit comments