3
3
4
4
import attr
5
5
6
- from ..types import UNSET , File , Unset
6
+ from ..types import UNSET , File , FileJsonType , Unset
7
7
8
8
T = TypeVar ("T" , bound = "BodyUploadFileTestsUploadPost" )
9
9
@@ -13,11 +13,16 @@ class BodyUploadFileTestsUploadPost:
13
13
""" """
14
14
15
15
some_file : File
16
+ some_optional_file : Union [Unset , File ] = UNSET
16
17
some_string : Union [Unset , str ] = "some_default_string"
17
18
18
19
def to_dict (self ) -> Dict [str , Any ]:
19
20
some_file = self .some_file .to_tuple ()
20
21
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
+
21
26
some_string = self .some_string
22
27
23
28
field_dict : Dict [str , Any ] = {}
@@ -26,6 +31,8 @@ def to_dict(self) -> Dict[str, Any]:
26
31
"some_file" : some_file ,
27
32
}
28
33
)
34
+ if some_optional_file is not UNSET :
35
+ field_dict ["some_optional_file" ] = some_optional_file
29
36
if some_string is not UNSET :
30
37
field_dict ["some_string" ] = some_string
31
38
@@ -36,10 +43,16 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
36
43
d = src_dict .copy ()
37
44
some_file = File (payload = BytesIO (d .pop ("some_file" )))
38
45
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
+
39
51
some_string = d .pop ("some_string" , UNSET )
40
52
41
53
body_upload_file_tests_upload_post = cls (
42
54
some_file = some_file ,
55
+ some_optional_file = some_optional_file ,
43
56
some_string = some_string ,
44
57
)
45
58
0 commit comments