openapi-python-client 0.24.2__tar.gz → 0.25.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/PKG-INFO +36 -3
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/README.md +33 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/const.py +0 -1
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/enum_property.py +11 -3
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/file.py +2 -2
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/list_property.py +0 -3
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/model_property.py +0 -3
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/protocol.py +0 -4
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/union.py +7 -10
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/endpoint_macros.py.jinja +10 -10
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/endpoint_module.py.jinja +2 -5
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/model.py.jinja +46 -18
- openapi_python_client-0.25.0/openapi_python_client/templates/property_templates/any_property.py.jinja +3 -0
- openapi_python_client-0.25.0/openapi_python_client/templates/property_templates/boolean_property.py.jinja +7 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/const_property.py.jinja +4 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/date_property.py.jinja +2 -10
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/datetime_property.py.jinja +2 -10
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/enum_property.py.jinja +3 -11
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/file_property.py.jinja +2 -8
- openapi_python_client-0.25.0/openapi_python_client/templates/property_templates/float_property.py.jinja +7 -0
- openapi_python_client-0.25.0/openapi_python_client/templates/property_templates/int_property.py.jinja +7 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/list_property.py.jinja +8 -31
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja +3 -11
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/model_property.py.jinja +7 -17
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/union_property.py.jinja +18 -15
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/uuid_property.py.jinja +2 -9
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/pyproject.toml.jinja +2 -2
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/setup.py.jinja +1 -1
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/types.py.jinja +13 -7
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/pyproject.toml +4 -4
- openapi_python_client-0.24.2/openapi_python_client/templates/property_templates/any_property.py.jinja +0 -7
- openapi_python_client-0.24.2/openapi_python_client/templates/property_templates/boolean_property.py.jinja +0 -11
- openapi_python_client-0.24.2/openapi_python_client/templates/property_templates/float_property.py.jinja +0 -11
- openapi_python_client-0.24.2/openapi_python_client/templates/property_templates/int_property.py.jinja +0 -11
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/.gitignore +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/LICENSE +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/__init__.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/__main__.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/cli.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/config.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/__init__.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/bodies.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/errors.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/openapi.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/__init__.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/any.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/boolean.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/date.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/datetime.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/float.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/int.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/literal_enum_property.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/merge_properties.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/none.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/property.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/schemas.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/string.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/properties/uuid.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/parser/responses.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/py.typed +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/3.0.3.md +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/3.1.0.md +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/__init__.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/data_type.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/LICENSE +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/README.md +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/__init__.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/callback.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/components.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/contact.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/example.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/header.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/info.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/license.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/link.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/media_type.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/operation.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/parameter.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/paths.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/reference.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/request_body.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/response.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/responses.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/schema.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/server.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/tag.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/openapi_schema_pydantic/xml.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/schema/parameter_location.py +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/.gitignore.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/README.md.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/api_init.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/client.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/endpoint_init.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/errors.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/helpers.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/int_enum.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/literal_enum.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/models_init.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/package_init.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/helpers.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/property_templates/property_macros.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/pyproject_ruff.toml.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/templates/str_enum.py.jinja +0 -0
- {openapi_python_client-0.24.2 → openapi_python_client-0.25.0}/openapi_python_client/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openapi-python-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.0
|
|
4
4
|
Summary: Generate modern Python clients from OpenAPI
|
|
5
5
|
Project-URL: repository, https://github.com/openapi-generators/openapi-python-client
|
|
6
6
|
Author-email: Dylan Anthony <contact@dylananthony.com>
|
|
@@ -21,14 +21,14 @@ Classifier: Typing :: Typed
|
|
|
21
21
|
Requires-Python: <4.0,>=3.9
|
|
22
22
|
Requires-Dist: attrs>=22.2.0
|
|
23
23
|
Requires-Dist: colorama>=0.4.3; sys_platform == 'win32'
|
|
24
|
-
Requires-Dist: httpx<0.29.0,>=0.
|
|
24
|
+
Requires-Dist: httpx<0.29.0,>=0.23.0
|
|
25
25
|
Requires-Dist: jinja2<4.0.0,>=3.0.0
|
|
26
26
|
Requires-Dist: pydantic<3.0.0,>=2.10
|
|
27
27
|
Requires-Dist: python-dateutil<3.0.0,>=2.8.1
|
|
28
28
|
Requires-Dist: ruamel-yaml<0.19.0,>=0.18.6
|
|
29
29
|
Requires-Dist: ruff<0.12,>=0.2
|
|
30
30
|
Requires-Dist: shellingham<2.0.0,>=1.3.2
|
|
31
|
-
Requires-Dist: typer<0.
|
|
31
|
+
Requires-Dist: typer<0.17,>0.6
|
|
32
32
|
Requires-Dist: typing-extensions<5.0.0,>=4.8.0
|
|
33
33
|
Description-Content-Type: text/markdown
|
|
34
34
|
|
|
@@ -226,6 +226,39 @@ content_type_overrides:
|
|
|
226
226
|
application/zip: application/octet-stream
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
+
## Supported Extensions
|
|
230
|
+
|
|
231
|
+
### x-enum-varnames
|
|
232
|
+
|
|
233
|
+
This extension has been adopted by similar projects such as [OpenAPI Tools](https://github.com/OpenAPITools/openapi-generator/pull/917).
|
|
234
|
+
It is intended to provide user-friendly names for integer Enum members that get generated.
|
|
235
|
+
It is critical that the length of the array matches that of the enum values.
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
"Colors": {
|
|
239
|
+
"type": "integer",
|
|
240
|
+
"format": "int32",
|
|
241
|
+
"enum": [
|
|
242
|
+
0,
|
|
243
|
+
1,
|
|
244
|
+
2
|
|
245
|
+
],
|
|
246
|
+
"x-enum-varnames": [
|
|
247
|
+
"Red",
|
|
248
|
+
"Green",
|
|
249
|
+
"Blue"
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Results in:
|
|
255
|
+
```
|
|
256
|
+
class Color(IntEnum):
|
|
257
|
+
RED = 0
|
|
258
|
+
GREEN = 1
|
|
259
|
+
BLUE = 2
|
|
260
|
+
```
|
|
261
|
+
|
|
229
262
|
[changelog.md]: CHANGELOG.md
|
|
230
263
|
[poetry]: https://python-poetry.org/
|
|
231
264
|
[PDM]: https://pdm-project.org/latest/
|
|
@@ -192,6 +192,39 @@ content_type_overrides:
|
|
|
192
192
|
application/zip: application/octet-stream
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
+
## Supported Extensions
|
|
196
|
+
|
|
197
|
+
### x-enum-varnames
|
|
198
|
+
|
|
199
|
+
This extension has been adopted by similar projects such as [OpenAPI Tools](https://github.com/OpenAPITools/openapi-generator/pull/917).
|
|
200
|
+
It is intended to provide user-friendly names for integer Enum members that get generated.
|
|
201
|
+
It is critical that the length of the array matches that of the enum values.
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
"Colors": {
|
|
205
|
+
"type": "integer",
|
|
206
|
+
"format": "int32",
|
|
207
|
+
"enum": [
|
|
208
|
+
0,
|
|
209
|
+
1,
|
|
210
|
+
2
|
|
211
|
+
],
|
|
212
|
+
"x-enum-varnames": [
|
|
213
|
+
"Red",
|
|
214
|
+
"Green",
|
|
215
|
+
"Blue"
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Results in:
|
|
221
|
+
```
|
|
222
|
+
class Color(IntEnum):
|
|
223
|
+
RED = 0
|
|
224
|
+
GREEN = 1
|
|
225
|
+
BLUE = 2
|
|
226
|
+
```
|
|
227
|
+
|
|
195
228
|
[changelog.md]: CHANGELOG.md
|
|
196
229
|
[poetry]: https://python-poetry.org/
|
|
197
230
|
[PDM]: https://pdm-project.org/latest/
|
|
@@ -121,7 +121,8 @@ class EnumProperty(PropertyProtocol):
|
|
|
121
121
|
if parent_name:
|
|
122
122
|
class_name = f"{utils.pascal_case(parent_name)}{utils.pascal_case(class_name)}"
|
|
123
123
|
class_info = Class.from_string(string=class_name, config=config)
|
|
124
|
-
|
|
124
|
+
var_names = data.model_extra.get("x-enum-varnames", []) if data.model_extra else []
|
|
125
|
+
values = EnumProperty.values_from_list(value_list, class_info, var_names)
|
|
125
126
|
|
|
126
127
|
if class_info.name in schemas.classes_by_name:
|
|
127
128
|
existing = schemas.classes_by_name[class_info.name]
|
|
@@ -183,14 +184,21 @@ class EnumProperty(PropertyProtocol):
|
|
|
183
184
|
return imports
|
|
184
185
|
|
|
185
186
|
@staticmethod
|
|
186
|
-
def values_from_list(
|
|
187
|
+
def values_from_list(
|
|
188
|
+
values: list[str] | list[int], class_info: Class, var_names: list[str]
|
|
189
|
+
) -> dict[str, ValueType]:
|
|
187
190
|
"""Convert a list of values into dict of {name: value}, where value can sometimes be None"""
|
|
188
191
|
output: dict[str, ValueType] = {}
|
|
192
|
+
use_var_names = len(var_names) == len(values)
|
|
189
193
|
|
|
190
194
|
for i, value in enumerate(values):
|
|
191
195
|
value = cast(Union[str, int], value)
|
|
192
196
|
if isinstance(value, int):
|
|
193
|
-
if
|
|
197
|
+
if use_var_names:
|
|
198
|
+
key = var_names[i]
|
|
199
|
+
sanitized_key = utils.snake_case(key).upper()
|
|
200
|
+
output[sanitized_key] = value
|
|
201
|
+
elif value < 0:
|
|
194
202
|
output[f"VALUE_NEGATIVE_{-value}"] = value
|
|
195
203
|
else:
|
|
196
204
|
output[f"VALUE_{value}"] = value
|
|
@@ -22,7 +22,7 @@ class FileProperty(PropertyProtocol):
|
|
|
22
22
|
|
|
23
23
|
_type_string: ClassVar[str] = "File"
|
|
24
24
|
# Return type of File.to_tuple()
|
|
25
|
-
_json_type_string: ClassVar[str] = "
|
|
25
|
+
_json_type_string: ClassVar[str] = "types.FileTypes"
|
|
26
26
|
template: ClassVar[str] = "file_property.py.jinja"
|
|
27
27
|
|
|
28
28
|
@classmethod
|
|
@@ -63,5 +63,5 @@ class FileProperty(PropertyProtocol):
|
|
|
63
63
|
back to the root of the generated client.
|
|
64
64
|
"""
|
|
65
65
|
imports = super().get_imports(prefix=prefix)
|
|
66
|
-
imports.update({f"from {prefix}types import File,
|
|
66
|
+
imports.update({f"from {prefix}types import File, FileTypes", "from io import BytesIO"})
|
|
67
67
|
return imports
|
|
@@ -138,7 +138,6 @@ class ListProperty(PropertyProtocol):
|
|
|
138
138
|
no_optional: bool = False,
|
|
139
139
|
json: bool = False,
|
|
140
140
|
*,
|
|
141
|
-
multipart: bool = False,
|
|
142
141
|
quoted: bool = False,
|
|
143
142
|
) -> str:
|
|
144
143
|
"""
|
|
@@ -150,8 +149,6 @@ class ListProperty(PropertyProtocol):
|
|
|
150
149
|
"""
|
|
151
150
|
if json:
|
|
152
151
|
type_string = self.get_base_json_type_string()
|
|
153
|
-
elif multipart:
|
|
154
|
-
type_string = "tuple[None, bytes, str]"
|
|
155
152
|
else:
|
|
156
153
|
type_string = self.get_base_type_string()
|
|
157
154
|
|
|
@@ -189,7 +189,6 @@ class ModelProperty(PropertyProtocol):
|
|
|
189
189
|
no_optional: bool = False,
|
|
190
190
|
json: bool = False,
|
|
191
191
|
*,
|
|
192
|
-
multipart: bool = False,
|
|
193
192
|
quoted: bool = False,
|
|
194
193
|
) -> str:
|
|
195
194
|
"""
|
|
@@ -201,8 +200,6 @@ class ModelProperty(PropertyProtocol):
|
|
|
201
200
|
"""
|
|
202
201
|
if json:
|
|
203
202
|
type_string = self.get_base_json_type_string()
|
|
204
|
-
elif multipart:
|
|
205
|
-
type_string = "tuple[None, bytes, str]"
|
|
206
203
|
else:
|
|
207
204
|
type_string = self.get_base_type_string()
|
|
208
205
|
|
|
@@ -101,7 +101,6 @@ class PropertyProtocol(Protocol):
|
|
|
101
101
|
no_optional: bool = False,
|
|
102
102
|
json: bool = False,
|
|
103
103
|
*,
|
|
104
|
-
multipart: bool = False,
|
|
105
104
|
quoted: bool = False,
|
|
106
105
|
) -> str:
|
|
107
106
|
"""
|
|
@@ -110,13 +109,10 @@ class PropertyProtocol(Protocol):
|
|
|
110
109
|
Args:
|
|
111
110
|
no_optional: Do not include Optional or Unset even if the value is optional (needed for isinstance checks)
|
|
112
111
|
json: True if the type refers to the property after JSON serialization
|
|
113
|
-
multipart: True if the type should be used in a multipart request
|
|
114
112
|
quoted: True if the type should be wrapped in quotes (if not a base type)
|
|
115
113
|
"""
|
|
116
114
|
if json:
|
|
117
115
|
type_string = self.get_base_json_type_string(quoted=quoted)
|
|
118
|
-
elif multipart:
|
|
119
|
-
type_string = "tuple[None, bytes, str]"
|
|
120
116
|
else:
|
|
121
117
|
type_string = self.get_base_type_string(quoted=quoted)
|
|
122
118
|
|
|
@@ -106,10 +106,9 @@ class UnionProperty(PropertyProtocol):
|
|
|
106
106
|
return value_or_error
|
|
107
107
|
return value_or_error
|
|
108
108
|
|
|
109
|
-
def _get_inner_type_strings(self, json: bool
|
|
109
|
+
def _get_inner_type_strings(self, json: bool) -> set[str]:
|
|
110
110
|
return {
|
|
111
|
-
p.get_type_string(no_optional=True, json=json,
|
|
112
|
-
for p in self.inner_properties
|
|
111
|
+
p.get_type_string(no_optional=True, json=json, quoted=not p.is_base_type) for p in self.inner_properties
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
@staticmethod
|
|
@@ -119,12 +118,12 @@ class UnionProperty(PropertyProtocol):
|
|
|
119
118
|
return f"Union[{', '.join(sorted(inner_types))}]"
|
|
120
119
|
|
|
121
120
|
def get_base_type_string(self, *, quoted: bool = False) -> str:
|
|
122
|
-
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False
|
|
121
|
+
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False))
|
|
123
122
|
|
|
124
123
|
def get_base_json_type_string(self, *, quoted: bool = False) -> str:
|
|
125
|
-
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True
|
|
124
|
+
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True))
|
|
126
125
|
|
|
127
|
-
def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool
|
|
126
|
+
def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool) -> set[str]:
|
|
128
127
|
"""
|
|
129
128
|
Get the set of all the types that should appear within the `Union` representing this property.
|
|
130
129
|
|
|
@@ -133,12 +132,11 @@ class UnionProperty(PropertyProtocol):
|
|
|
133
132
|
Args:
|
|
134
133
|
no_optional: Do not include `None` or `Unset` in this set.
|
|
135
134
|
json: If True, this returns the JSON types, not the Python types, of this property.
|
|
136
|
-
multipart: If True, this returns the multipart types, not the Python types, of this property.
|
|
137
135
|
|
|
138
136
|
Returns:
|
|
139
137
|
A set of strings containing the types that should appear within `Union`.
|
|
140
138
|
"""
|
|
141
|
-
type_strings = self._get_inner_type_strings(json=json
|
|
139
|
+
type_strings = self._get_inner_type_strings(json=json)
|
|
142
140
|
if no_optional:
|
|
143
141
|
return type_strings
|
|
144
142
|
if not self.required:
|
|
@@ -150,7 +148,6 @@ class UnionProperty(PropertyProtocol):
|
|
|
150
148
|
no_optional: bool = False,
|
|
151
149
|
json: bool = False,
|
|
152
150
|
*,
|
|
153
|
-
multipart: bool = False,
|
|
154
151
|
quoted: bool = False,
|
|
155
152
|
) -> str:
|
|
156
153
|
"""
|
|
@@ -158,7 +155,7 @@ class UnionProperty(PropertyProtocol):
|
|
|
158
155
|
This implementation differs slightly from `Property.get_type_string` in order to collapse
|
|
159
156
|
nested union types.
|
|
160
157
|
"""
|
|
161
|
-
type_strings_in_union = self.get_type_strings_in_union(no_optional=no_optional, json=json
|
|
158
|
+
type_strings_in_union = self.get_type_strings_in_union(no_optional=no_optional, json=json)
|
|
162
159
|
return self._get_type_string_from_inner_type_strings(type_strings_in_union)
|
|
163
160
|
|
|
164
161
|
def get_imports(self, *, prefix: str) -> set[str]:
|
|
@@ -58,33 +58,33 @@ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
|
58
58
|
{% endif %}
|
|
59
59
|
{% endmacro %}
|
|
60
60
|
|
|
61
|
-
{% macro body_to_kwarg(body
|
|
61
|
+
{% macro body_to_kwarg(body) %}
|
|
62
62
|
{% if body.body_type == "data" %}
|
|
63
|
-
|
|
63
|
+
_kwargs["data"] = body.to_dict()
|
|
64
64
|
{% elif body.body_type == "files"%}
|
|
65
|
-
{{ multipart_body(body
|
|
65
|
+
{{ multipart_body(body) }}
|
|
66
66
|
{% elif body.body_type == "json" %}
|
|
67
|
-
{{ json_body(body
|
|
67
|
+
{{ json_body(body) }}
|
|
68
68
|
{% elif body.body_type == "content" %}
|
|
69
|
-
|
|
69
|
+
_kwargs["content"] = body.payload
|
|
70
70
|
{% endif %}
|
|
71
71
|
{% endmacro %}
|
|
72
72
|
|
|
73
|
-
{% macro json_body(body
|
|
73
|
+
{% macro json_body(body) %}
|
|
74
74
|
{% set property = body.prop %}
|
|
75
75
|
{% import "property_templates/" + property.template as prop_template %}
|
|
76
76
|
{% if prop_template.transform %}
|
|
77
|
-
{{ prop_template.transform(property, property.python_name,
|
|
77
|
+
{{ prop_template.transform(property, property.python_name, "_kwargs[\"json\"]") }}
|
|
78
78
|
{% else %}
|
|
79
|
-
|
|
79
|
+
_kwargs["json"] = {{ property.python_name }}
|
|
80
80
|
{% endif %}
|
|
81
81
|
{% endmacro %}
|
|
82
82
|
|
|
83
|
-
{% macro multipart_body(body
|
|
83
|
+
{% macro multipart_body(body) %}
|
|
84
84
|
{% set property = body.prop %}
|
|
85
85
|
{% import "property_templates/" + property.template as prop_template %}
|
|
86
86
|
{% if prop_template.transform_multipart_body %}
|
|
87
|
-
{{ prop_template.transform_multipart_body(property
|
|
87
|
+
{{ prop_template.transform_multipart_body(property) }}
|
|
88
88
|
{% endif %}
|
|
89
89
|
{% endmacro %}
|
|
90
90
|
|
|
@@ -48,15 +48,12 @@ def _get_kwargs(
|
|
|
48
48
|
{% if endpoint.bodies | length > 1 %}
|
|
49
49
|
{% for body in endpoint.bodies %}
|
|
50
50
|
if isinstance(body, {{body.prop.get_type_string() }}):
|
|
51
|
-
{
|
|
52
|
-
{{ body_to_kwarg(body, destination) | indent(8) }}
|
|
53
|
-
_kwargs["{{ body.body_type.value }}"] = {{ destination }}
|
|
51
|
+
{{ body_to_kwarg(body) | indent(8) }}
|
|
54
52
|
headers["Content-Type"] = "{{ body.content_type }}"
|
|
55
53
|
{% endfor %}
|
|
56
54
|
{% elif endpoint.bodies | length == 1 %}
|
|
57
55
|
{% set body = endpoint.bodies[0] %}
|
|
58
|
-
{{ body_to_kwarg(body
|
|
59
|
-
_kwargs["{{ body.body_type.value }}"] = _body
|
|
56
|
+
{{ body_to_kwarg(body) | indent(4) }}
|
|
60
57
|
{% if body.content_type != "multipart/form-data" %}{# Need httpx to set the boundary automatically #}
|
|
61
58
|
headers["Content-Type"] = "{{ body.content_type }}"
|
|
62
59
|
{% endif %}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from collections.abc import Mapping
|
|
2
|
-
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING
|
|
2
|
+
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
|
3
3
|
|
|
4
4
|
from attrs import define as _attrs_define
|
|
5
5
|
from attrs import field as _attrs_field
|
|
6
6
|
{% if model.is_multipart_body %}
|
|
7
7
|
import json
|
|
8
|
+
from .. import types
|
|
8
9
|
{% endif %}
|
|
9
10
|
|
|
10
11
|
from ..types import UNSET, Unset
|
|
@@ -82,32 +83,45 @@ class {{ class_name }}:
|
|
|
82
83
|
additional_properties: dict[str, {{ additional_property_type }}] = _attrs_field(init=False, factory=dict)
|
|
83
84
|
{% endif %}
|
|
84
85
|
|
|
85
|
-
{% macro
|
|
86
|
-
{% for property in model.required_properties + model.optional_properties %}
|
|
86
|
+
{% macro _transform_property(property, content) %}
|
|
87
87
|
{% import "property_templates/" + property.template as prop_template %}
|
|
88
|
-
{
|
|
89
|
-
{{ prop_template.
|
|
90
|
-
{
|
|
91
|
-
{{
|
|
88
|
+
{%- if prop_template.transform -%}
|
|
89
|
+
{{ prop_template.transform(property=property, source=content, destination=property.python_name) }}
|
|
90
|
+
{%- else -%}
|
|
91
|
+
{{ property.python_name }} = {{ content }}
|
|
92
|
+
{%- endif -%}
|
|
93
|
+
{% endmacro %}
|
|
94
|
+
|
|
95
|
+
{% macro multipart(property, source, destination) %}
|
|
96
|
+
{% import "property_templates/" + property.template as prop_template %}
|
|
97
|
+
{% if not property.required %}
|
|
98
|
+
if not isinstance({{source}}, Unset):
|
|
99
|
+
{{ prop_template.multipart(property, source, destination) | indent(4) }}
|
|
92
100
|
{% else %}
|
|
93
|
-
{{ property
|
|
101
|
+
{{ prop_template.multipart(property, source, destination) }}
|
|
94
102
|
{% endif %}
|
|
103
|
+
{% endmacro %}
|
|
95
104
|
|
|
96
|
-
{%
|
|
97
|
-
|
|
105
|
+
{% macro _prepare_field_dict() %}
|
|
98
106
|
field_dict: dict[str, Any] = {}
|
|
99
107
|
{% if model.additional_properties %}
|
|
100
108
|
{% import "property_templates/" + model.additional_properties.template as prop_template %}
|
|
101
|
-
{% if
|
|
102
|
-
for prop_name, prop in self.additional_properties.items():
|
|
103
|
-
{{ prop_template.transform_multipart(model.additional_properties, "prop", "field_dict[prop_name]") | indent(4) }}
|
|
104
|
-
{% elif prop_template.transform %}
|
|
109
|
+
{% if prop_template.transform %}
|
|
105
110
|
for prop_name, prop in self.additional_properties.items():
|
|
106
111
|
{{ prop_template.transform(model.additional_properties, "prop", "field_dict[prop_name]", declare_type=false) | indent(4) }}
|
|
107
112
|
{% else %}
|
|
108
113
|
field_dict.update(self.additional_properties)
|
|
109
|
-
{
|
|
110
|
-
{
|
|
114
|
+
{%- endif -%}
|
|
115
|
+
{%- endif -%}
|
|
116
|
+
{% endmacro %}
|
|
117
|
+
|
|
118
|
+
{% macro _to_dict() %}
|
|
119
|
+
{% for property in model.required_properties + model.optional_properties -%}
|
|
120
|
+
{{ _transform_property(property, "self." + property.python_name) }}
|
|
121
|
+
|
|
122
|
+
{% endfor %}
|
|
123
|
+
|
|
124
|
+
{{ _prepare_field_dict() }}
|
|
111
125
|
{% if model.required_properties | length > 0 or model.optional_properties | length > 0 %}
|
|
112
126
|
field_dict.update({
|
|
113
127
|
{% for property in model.required_properties + model.optional_properties %}
|
|
@@ -134,8 +148,22 @@ return field_dict
|
|
|
134
148
|
{{ _to_dict() | indent(8) }}
|
|
135
149
|
|
|
136
150
|
{% if model.is_multipart_body %}
|
|
137
|
-
def to_multipart(self) ->
|
|
138
|
-
|
|
151
|
+
def to_multipart(self) -> types.RequestFiles:
|
|
152
|
+
files: types.RequestFiles = []
|
|
153
|
+
|
|
154
|
+
{% for property in model.required_properties + model.optional_properties %}
|
|
155
|
+
{% set destination = "\"" + property.name + "\"" %}
|
|
156
|
+
{{ multipart(property, "self." + property.python_name, destination) | indent(8) }}
|
|
157
|
+
|
|
158
|
+
{% endfor %}
|
|
159
|
+
|
|
160
|
+
{% if model.additional_properties %}
|
|
161
|
+
for prop_name, prop in self.additional_properties.items():
|
|
162
|
+
{{ multipart(model.additional_properties, "prop", "prop_name") | indent(4) }}
|
|
163
|
+
{% endif %}
|
|
164
|
+
|
|
165
|
+
return files
|
|
166
|
+
|
|
139
167
|
{% endif %}
|
|
140
168
|
|
|
141
169
|
@classmethod
|
|
@@ -3,3 +3,7 @@
|
|
|
3
3
|
if {{ property.python_name }} != {{ property.value.python_code }}{% if not property.required %}and not isinstance({{ property.python_name }}, Unset){% endif %}:
|
|
4
4
|
raise ValueError(f"{{ property.name }} must match const {{ property.value.python_code }}, got '{{'{' + property.python_name + '}' }}'")
|
|
5
5
|
{%- endmacro %}
|
|
6
|
+
|
|
7
|
+
{% macro multipart(property, source, name) %}
|
|
8
|
+
files.append(({{ name }}, (None, {{ source }}, "text/plain")))
|
|
9
|
+
{% endmacro %}
|
|
@@ -26,14 +26,6 @@ if not isinstance({{ source }}, Unset):
|
|
|
26
26
|
{%- endif %}
|
|
27
27
|
{% endmacro %}
|
|
28
28
|
|
|
29
|
-
{% macro
|
|
30
|
-
{
|
|
31
|
-
{% if property.required %}
|
|
32
|
-
{{ destination }} = {{ transformed }}
|
|
33
|
-
{%- else %}
|
|
34
|
-
{% set type_annotation = property.get_type_string(json=True) | replace("str", "bytes") %}
|
|
35
|
-
{{ destination }}: {{ type_annotation }} = UNSET
|
|
36
|
-
if not isinstance({{ source }}, Unset):
|
|
37
|
-
{{ destination }} = {{ transformed }}
|
|
38
|
-
{%- endif %}
|
|
29
|
+
{% macro multipart(property, source, name) %}
|
|
30
|
+
files.append(({{ name }}, (None, {{ source }}.isoformat().encode(), "text/plain")))
|
|
39
31
|
{% endmacro %}
|
|
@@ -26,14 +26,6 @@ if not isinstance({{ source }}, Unset):
|
|
|
26
26
|
{%- endif %}
|
|
27
27
|
{% endmacro %}
|
|
28
28
|
|
|
29
|
-
{% macro
|
|
30
|
-
{
|
|
31
|
-
{% if property.required %}
|
|
32
|
-
{{ destination }} = {{ transformed }}
|
|
33
|
-
{%- else %}
|
|
34
|
-
{% set type_annotation = property.get_type_string(json=True) | replace("str", "bytes") %}
|
|
35
|
-
{{ destination }}: {{ type_annotation }} = UNSET
|
|
36
|
-
if not isinstance({{ source }}, Unset):
|
|
37
|
-
{{ destination }} = {{ transformed }}
|
|
38
|
-
{%- endif %}
|
|
29
|
+
{% macro multipart(property, source, name) %}
|
|
30
|
+
files.append(({{ name }}, (None, {{ source }}.isoformat().encode(), "text/plain")))
|
|
39
31
|
{% endmacro %}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.value_type.__name__ }}){% endmacro %}
|
|
12
12
|
|
|
13
|
-
{% macro transform(property, source, destination, declare_type=True
|
|
13
|
+
{% macro transform(property, source, destination, declare_type=True) %}
|
|
14
14
|
{% set transformed = source + ".value" %}
|
|
15
15
|
{% set type_string = property.get_type_string(json=True) %}
|
|
16
16
|
{% if property.required %}
|
|
@@ -22,16 +22,8 @@ if not isinstance({{ source }}, Unset):
|
|
|
22
22
|
{% endif %}
|
|
23
23
|
{% endmacro %}
|
|
24
24
|
|
|
25
|
-
{% macro
|
|
26
|
-
{
|
|
27
|
-
{% set type_string = "Union[Unset, tuple[None, bytes, str]]" %}
|
|
28
|
-
{% if property.required %}
|
|
29
|
-
{{ destination }} = {{ transformed }}
|
|
30
|
-
{%- else %}
|
|
31
|
-
{{ destination }}: {{ type_string }} = UNSET
|
|
32
|
-
if not isinstance({{ source }}, Unset):
|
|
33
|
-
{{ destination }} = {{ transformed }}
|
|
34
|
-
{% endif %}
|
|
25
|
+
{% macro multipart(property, source, name) %}
|
|
26
|
+
files.append(({{ name }}, (None, str({{ source }}.value).encode(), "text/plain")))
|
|
35
27
|
{% endmacro %}
|
|
36
28
|
|
|
37
29
|
{% macro transform_header(source) %}
|
|
@@ -22,12 +22,6 @@ if not isinstance({{ source }}, Unset):
|
|
|
22
22
|
{% endif %}
|
|
23
23
|
{% endmacro %}
|
|
24
24
|
|
|
25
|
-
{% macro
|
|
26
|
-
{
|
|
27
|
-
{{ destination }} = {{ source }}.to_tuple()
|
|
28
|
-
{% else %}
|
|
29
|
-
{{ destination }}: {{ property.get_type_string(json=True) }} = UNSET
|
|
30
|
-
if not isinstance({{ source }}, Unset):
|
|
31
|
-
{{ destination }} = {{ source }}.to_tuple()
|
|
32
|
-
{% endif %}
|
|
25
|
+
{% macro multipart(property, source, name) %}
|
|
26
|
+
files.append(({{ name }}, {{ source }}.to_tuple()))
|
|
33
27
|
{% endmacro %}
|
|
@@ -17,12 +17,8 @@ for {{ inner_source }} in (_{{ property.python_name }} or []):
|
|
|
17
17
|
{% endif %}
|
|
18
18
|
{% endmacro %}
|
|
19
19
|
|
|
20
|
-
{% macro _transform(property, source, destination,
|
|
20
|
+
{% macro _transform(property, source, destination, transform_method) %}
|
|
21
21
|
{% set inner_property = property.inner_property %}
|
|
22
|
-
{% if multipart %}
|
|
23
|
-
{% set multipart_destination = destination %}
|
|
24
|
-
{% set destination = "_temp_" + destination %}
|
|
25
|
-
{% endif %}
|
|
26
22
|
{% import "property_templates/" + inner_property.template as inner_template %}
|
|
27
23
|
{% if inner_template.transform %}
|
|
28
24
|
{% set inner_source = inner_property.python_name + "_data" %}
|
|
@@ -33,9 +29,6 @@ for {{ inner_source }} in {{ source }}:
|
|
|
33
29
|
{% else %}
|
|
34
30
|
{{ destination }} = {{ source }}
|
|
35
31
|
{% endif %}
|
|
36
|
-
{% if multipart %}
|
|
37
|
-
{{ multipart_destination }} = (None, json.dumps({{ destination }}).encode(), 'application/json')
|
|
38
|
-
{% endif %}
|
|
39
32
|
{% endmacro %}
|
|
40
33
|
|
|
41
34
|
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, list){% endmacro %}
|
|
@@ -44,34 +37,18 @@ for {{ inner_source }} in {{ source }}:
|
|
|
44
37
|
{% set inner_property = property.inner_property %}
|
|
45
38
|
{% set type_string = property.get_type_string(json=True) %}
|
|
46
39
|
{% if property.required %}
|
|
47
|
-
{{ _transform(property, source, destination,
|
|
40
|
+
{{ _transform(property, source, destination, "to_dict") }}
|
|
48
41
|
{% else %}
|
|
49
42
|
{{ destination }}{% if declare_type %}: {{ type_string }}{% endif %} = UNSET
|
|
50
43
|
if not isinstance({{ source }}, Unset):
|
|
51
|
-
{{ _transform(property, source, destination,
|
|
52
|
-
{% endif %}
|
|
53
|
-
{% endmacro %}
|
|
54
|
-
|
|
55
|
-
{% macro transform_multipart(property, source, destination) %}
|
|
56
|
-
{% set inner_property = property.inner_property %}
|
|
57
|
-
{% set type_string = "Union[Unset, tuple[None, bytes, str]]" %}
|
|
58
|
-
{% if property.required %}
|
|
59
|
-
{{ _transform(property, source, destination, True, "to_dict") }}
|
|
60
|
-
{% else %}
|
|
61
|
-
{{ destination }}: {{ type_string }} = UNSET
|
|
62
|
-
if not isinstance({{ source }}, Unset):
|
|
63
|
-
{{ _transform(property, source, destination, True, "to_dict") | indent(4)}}
|
|
44
|
+
{{ _transform(property, source, destination, "to_dict") | indent(4)}}
|
|
64
45
|
{% endif %}
|
|
65
46
|
{% endmacro %}
|
|
66
47
|
|
|
67
|
-
{% macro
|
|
48
|
+
{% macro multipart(property, source, destination) %}
|
|
68
49
|
{% set inner_property = property.inner_property %}
|
|
69
|
-
{%
|
|
70
|
-
{%
|
|
71
|
-
{{
|
|
72
|
-
{
|
|
73
|
-
{{ destination }}: {{ type_string }} = UNSET
|
|
74
|
-
if not isinstance({{ source }}, Unset):
|
|
75
|
-
{{ _transform(property, source, destination, False, "to_multipart") | indent(4)}}
|
|
76
|
-
{% endif %}
|
|
50
|
+
{% import "property_templates/" + inner_property.template as inner_template %}
|
|
51
|
+
{% set inner_source = inner_property.python_name + "_element" %}
|
|
52
|
+
for {{ inner_source }} in {{ source }}:
|
|
53
|
+
{{ inner_template.multipart(inner_property, inner_source, destination) | indent(4) }}
|
|
77
54
|
{% endmacro %}
|