33
44import attr
55
6- from ..types import UNSET , File , Unset
6+ from ..types import UNSET , File , FileJsonType , Unset
77
88T = TypeVar ("T" , bound = "BodyUploadFileTestsUploadPost" )
99
@@ -13,11 +13,16 @@ class BodyUploadFileTestsUploadPost:
1313 """ """
1414
1515 some_file : File
16+ some_optional_file : Union [Unset , File ] = UNSET
1617 some_string : Union [Unset , str ] = "some_default_string"
1718
1819 def to_dict (self ) -> Dict [str , Any ]:
1920 some_file = self .some_file .to_tuple ()
2021
22+ some_optional_file : Union [Unset , FileJsonType ] = UNSET
23+ if not isinstance (self .some_optional_file , Unset ):
24+ some_optional_file = self .some_optional_file .to_tuple ()
25+
2126 some_string = self .some_string
2227
2328 field_dict : Dict [str , Any ] = {}
@@ -26,6 +31,8 @@ def to_dict(self) -> Dict[str, Any]:
2631 "some_file" : some_file ,
2732 }
2833 )
34+ if some_optional_file is not UNSET :
35+ field_dict ["some_optional_file" ] = some_optional_file
2936 if some_string is not UNSET :
3037 field_dict ["some_string" ] = some_string
3138
@@ -36,10 +43,16 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
3643 d = src_dict .copy ()
3744 some_file = File (payload = BytesIO (d .pop ("some_file" )))
3845
46+ some_optional_file : Union [Unset , File ] = UNSET
47+ _some_optional_file = d .pop ("some_optional_file" , UNSET )
48+ if not isinstance (_some_optional_file , Unset ):
49+ some_optional_file = File (payload = BytesIO (_some_optional_file ))
50+
3951 some_string = d .pop ("some_string" , UNSET )
4052
4153 body_upload_file_tests_upload_post = cls (
4254 some_file = some_file ,
55+ some_optional_file = some_optional_file ,
4356 some_string = some_string ,
4457 )
4558
0 commit comments