@@ -588,48 +588,6 @@ class ExtractImagesPayload(BaseModel):
588588CmykChannel = Annotated [int , Field (ge = 0 , le = 100 )]
589589
590590
591- def _validate_rgb_values (value : Any ) -> tuple [int , int , int ] | None :
592- normalized = _split_comma_string (value )
593- if normalized is None :
594- return None
595- if len (normalized ) != 3 :
596- msg = "text_color_rgb must have exactly 3 values."
597- raise ValueError (msg )
598- channels : list [int ] = []
599- for channel in normalized :
600- try :
601- numeric = int (channel )
602- except (TypeError , ValueError ) as exc :
603- msg = "text_color_rgb values must be integers."
604- raise ValueError (msg ) from exc
605- if not 0 <= numeric <= 255 :
606- msg = "text_color_rgb values must be between 0 and 255."
607- raise ValueError (msg )
608- channels .append (numeric )
609- return (channels [0 ], channels [1 ], channels [2 ])
610-
611-
612- def _validate_cmyk_values (value : Any ) -> tuple [int , int , int , int ] | None :
613- normalized = _split_comma_string (value )
614- if normalized is None :
615- return None
616- if len (normalized ) != 4 :
617- msg = "text_color_cmyk must have exactly 4 values."
618- raise ValueError (msg )
619- channels : list [int ] = []
620- for channel in normalized :
621- try :
622- numeric = int (channel )
623- except (TypeError , ValueError ) as exc :
624- msg = "text_color_cmyk values must be integers."
625- raise ValueError (msg ) from exc
626- if not 0 <= numeric <= 100 :
627- msg = "text_color_cmyk values must be between 0 and 100."
628- raise ValueError (msg )
629- channels .append (numeric )
630- return (channels [0 ], channels [1 ], channels [2 ], channels [3 ])
631-
632-
633591class PdfLiteralRedactionModel (BaseModel ):
634592 type : Literal ["literal" ]
635593 value : Annotated [str , Field (min_length = 1 )]
@@ -1107,13 +1065,13 @@ class PdfAddTextObjectModel(BaseModel):
11071065 text_color_rgb : Annotated [
11081066 tuple [RgbChannel , RgbChannel , RgbChannel ] | None ,
11091067 Field (serialization_alias = "text_color_rgb" , default = None ),
1110- BeforeValidator (_validate_rgb_values ),
1068+ BeforeValidator (_split_comma_string ),
11111069 PlainSerializer (_serialize_as_comma_separated_string ),
11121070 ] = None
11131071 text_color_cmyk : Annotated [
11141072 tuple [CmykChannel , CmykChannel , CmykChannel , CmykChannel ] | None ,
11151073 Field (serialization_alias = "text_color_cmyk" , default = None ),
1116- BeforeValidator (_validate_cmyk_values ),
1074+ BeforeValidator (_split_comma_string ),
11171075 PlainSerializer (_serialize_as_comma_separated_string ),
11181076 ] = None
11191077 text_size : Annotated [
0 commit comments