@@ -17,10 +17,10 @@ for {{ inner_source }} in (_{{ property.python_name }} or []):
17
17
{% endif %}
18
18
{% endmacro %}
19
19
20
- {% macro _transform (property , source , destination , stringify , transform_method ) %}
20
+ {% macro _transform (property , source , destination , multipart , transform_method ) %}
21
21
{% set inner_property = property .inner_property %}
22
- {% if stringify %}
23
- {% set stringified_destination = destination %}
22
+ {% if multipart %}
23
+ {% set multipart_destination = destination %}
24
24
{% set destination = "_temp_" + destination %}
25
25
{% endif %}
26
26
{% if inner_property .template %}
@@ -33,17 +33,17 @@ for {{ inner_source }} in {{ source }}:
33
33
{% else %}
34
34
{{ destination }} = {{ source }}
35
35
{% endif %}
36
- {% if stringify %}
37
- {{ stringified_destination }} = (None, json.dumps({{ destination }}), 'application/json')
36
+ {% if multipart %}
37
+ {{ multipart_destination }} = (None, json.dumps({{ destination }}).encode( ), 'application/json')
38
38
{% endif %}
39
39
{% endmacro %}
40
40
41
41
{% macro check_type_for_construct (property , source ) %} isinstance({{ source }}, list){% endmacro %}
42
42
43
- {% macro transform (property , source , destination , declare_type =True , stringify =False , transform_method ="to_dict" ) %}
43
+ {% macro transform (property , source , destination , declare_type =True , multipart =False , transform_method ="to_dict" ) %}
44
44
{% set inner_property = property .inner_property %}
45
- {% if stringify %}
46
- {% set type_string = "Union[Unset, Tuple[None, str , str]]" %}
45
+ {% if multipart %}
46
+ {% set type_string = "Union[Unset, Tuple[None, bytes , str]]" %}
47
47
{% else %}
48
48
{% set type_string = property .get_type_string (json =True ) %}
49
49
{% endif %}
@@ -52,9 +52,9 @@ for {{ inner_source }} in {{ source }}:
52
52
if {{ source }} is None:
53
53
{{ destination }} = None
54
54
else:
55
- {{ _transform(property, source, destination, stringify , transform_method) | indent(4) }}
55
+ {{ _transform(property, source, destination, multipart , transform_method) | indent(4) }}
56
56
{% else %}
57
- {{ _transform(property, source, destination, stringify , transform_method) }}
57
+ {{ _transform(property, source, destination, multipart , transform_method) }}
58
58
{% endif %}
59
59
{% else %}
60
60
{{ destination }}{% if declare_type %} : {{ type_string }}{% endif %} = UNSET
@@ -63,9 +63,9 @@ if not isinstance({{ source }}, Unset):
63
63
if {{ source }} is None:
64
64
{{ destination }} = None
65
65
else:
66
- {{ _transform(property, source, destination, stringify , transform_method) | indent(8)}}
66
+ {{ _transform(property, source, destination, multipart , transform_method) | indent(8)}}
67
67
{% else %}
68
- {{ _transform(property, source, destination, stringify , transform_method) | indent(4)}}
68
+ {{ _transform(property, source, destination, multipart , transform_method) | indent(4)}}
69
69
{% endif %}
70
70
{% endif %}
71
71
0 commit comments