pyopenapi-gen 0.20.0__py3-none-any.whl → 0.21.0__py3-none-any.whl
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.
Potentially problematic release.
This version of pyopenapi-gen might be problematic. Click here for more details.
- pyopenapi_gen/__init__.py +1 -1
- pyopenapi_gen/core/utils.py +21 -2
- pyopenapi_gen/visit/endpoint/generators/endpoint_method_generator.py +2 -2
- pyopenapi_gen/visit/endpoint/generators/overload_generator.py +9 -2
- {pyopenapi_gen-0.20.0.dist-info → pyopenapi_gen-0.21.0.dist-info}/METADATA +1 -1
- {pyopenapi_gen-0.20.0.dist-info → pyopenapi_gen-0.21.0.dist-info}/RECORD +9 -9
- {pyopenapi_gen-0.20.0.dist-info → pyopenapi_gen-0.21.0.dist-info}/WHEEL +0 -0
- {pyopenapi_gen-0.20.0.dist-info → pyopenapi_gen-0.21.0.dist-info}/entry_points.txt +0 -0
- {pyopenapi_gen-0.20.0.dist-info → pyopenapi_gen-0.21.0.dist-info}/licenses/LICENSE +0 -0
pyopenapi_gen/__init__.py
CHANGED
|
@@ -50,7 +50,7 @@ __all__ = [
|
|
|
50
50
|
]
|
|
51
51
|
|
|
52
52
|
# Semantic version of the generator core – automatically managed by semantic-release.
|
|
53
|
-
__version__: str = "0.
|
|
53
|
+
__version__: str = "0.21.0"
|
|
54
54
|
|
|
55
55
|
# ---------------------------------------------------------------------------
|
|
56
56
|
# Lazy-loading and autocompletion support (This part remains)
|
pyopenapi_gen/core/utils.py
CHANGED
|
@@ -328,10 +328,12 @@ class DataclassSerializer:
|
|
|
328
328
|
The serialized object with dataclasses converted to dictionaries.
|
|
329
329
|
|
|
330
330
|
Handles:
|
|
331
|
-
-
|
|
331
|
+
- BaseSchema instances: Uses to_dict() method with field name mapping (e.g., snake_case -> camelCase)
|
|
332
|
+
- Regular dataclass instances: Converted to dictionaries using field names
|
|
332
333
|
- Lists: Recursively serialize each item
|
|
333
334
|
- Dictionaries: Recursively serialize values
|
|
334
335
|
- datetime: Convert to ISO format string
|
|
336
|
+
- Enums: Convert to their value
|
|
335
337
|
- Primitives: Return unchanged
|
|
336
338
|
- None values: Excluded from output
|
|
337
339
|
"""
|
|
@@ -363,7 +365,24 @@ class DataclassSerializer:
|
|
|
363
365
|
if isinstance(obj, Enum) and not isinstance(obj, type):
|
|
364
366
|
return obj.value
|
|
365
367
|
|
|
366
|
-
# Handle
|
|
368
|
+
# Handle BaseSchema instances (respects field name mappings)
|
|
369
|
+
# Check for BaseSchema by looking for both to_dict and _get_field_mappings methods
|
|
370
|
+
if hasattr(obj, "to_dict") and hasattr(obj, "_get_field_mappings") and callable(obj.to_dict):
|
|
371
|
+
visited.add(obj_id)
|
|
372
|
+
try:
|
|
373
|
+
# Use BaseSchema's to_dict() which handles field name mapping
|
|
374
|
+
result_dict = obj.to_dict(exclude_none=True)
|
|
375
|
+
# Recursively serialize nested objects in the result
|
|
376
|
+
serialized_result = {}
|
|
377
|
+
for key, value in result_dict.items():
|
|
378
|
+
serialized_value = DataclassSerializer._serialize_with_tracking(value, visited)
|
|
379
|
+
if serialized_value is not None:
|
|
380
|
+
serialized_result[key] = serialized_value
|
|
381
|
+
return serialized_result
|
|
382
|
+
finally:
|
|
383
|
+
visited.discard(obj_id)
|
|
384
|
+
|
|
385
|
+
# Handle regular dataclass instances (no field mapping)
|
|
367
386
|
if dataclasses.is_dataclass(obj) and not isinstance(obj, type):
|
|
368
387
|
visited.add(obj_id)
|
|
369
388
|
try:
|
|
@@ -181,12 +181,12 @@ class EndpointMethodGenerator:
|
|
|
181
181
|
writer.dedent()
|
|
182
182
|
writer.write_line(")")
|
|
183
183
|
elif content_type == "multipart/form-data":
|
|
184
|
-
|
|
184
|
+
# Files dict is already in correct format for httpx - pass directly
|
|
185
185
|
writer.write_line("response = await self._transport.request(")
|
|
186
186
|
writer.indent()
|
|
187
187
|
writer.write_line(f'"{op.method.value.upper()}", url,')
|
|
188
188
|
writer.write_line("params=None,")
|
|
189
|
-
writer.write_line("files=
|
|
189
|
+
writer.write_line(f"files={param_info['name']},")
|
|
190
190
|
writer.write_line("headers=None")
|
|
191
191
|
writer.dedent()
|
|
192
192
|
writer.write_line(")")
|
|
@@ -6,6 +6,7 @@ from typing import Any
|
|
|
6
6
|
from pyopenapi_gen import IROperation
|
|
7
7
|
|
|
8
8
|
from ....context.render_context import RenderContext
|
|
9
|
+
from ....core.utils import NameSanitizer
|
|
9
10
|
from ....core.writers.code_writer import CodeWriter
|
|
10
11
|
from ..processors.parameter_processor import EndpointParameterProcessor
|
|
11
12
|
from .docstring_generator import EndpointDocstringGenerator
|
|
@@ -134,9 +135,12 @@ class OverloadMethodGenerator:
|
|
|
134
135
|
# Get return type from response strategy
|
|
135
136
|
return_type = response_strategy.return_type
|
|
136
137
|
|
|
138
|
+
# Sanitize method name to snake_case
|
|
139
|
+
method_name = NameSanitizer.sanitize_method_name(op.operation_id)
|
|
140
|
+
|
|
137
141
|
# Write signature
|
|
138
142
|
params_str = ",\n ".join(param_parts)
|
|
139
|
-
writer.write_line(f"async def {
|
|
143
|
+
writer.write_line(f"async def {method_name}(")
|
|
140
144
|
writer.indent()
|
|
141
145
|
writer.write_line(params_str)
|
|
142
146
|
writer.dedent()
|
|
@@ -232,9 +236,12 @@ class OverloadMethodGenerator:
|
|
|
232
236
|
# Get return type
|
|
233
237
|
return_type = response_strategy.return_type
|
|
234
238
|
|
|
239
|
+
# Sanitize method name to snake_case
|
|
240
|
+
method_name = NameSanitizer.sanitize_method_name(op.operation_id)
|
|
241
|
+
|
|
235
242
|
# Write signature
|
|
236
243
|
params_str = ",\n ".join(param_parts)
|
|
237
|
-
writer.write_line(f"async def {
|
|
244
|
+
writer.write_line(f"async def {method_name}(")
|
|
238
245
|
writer.indent()
|
|
239
246
|
writer.write_line(params_str)
|
|
240
247
|
writer.dedent()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyopenapi-gen
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: Modern, async-first Python client generator for OpenAPI specifications with advanced cycle detection and unified type resolution
|
|
5
5
|
Project-URL: Homepage, https://github.com/your-org/pyopenapi-gen
|
|
6
6
|
Project-URL: Documentation, https://github.com/your-org/pyopenapi-gen/blob/main/README.md
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
pyopenapi_gen/__init__.py,sha256=
|
|
1
|
+
pyopenapi_gen/__init__.py,sha256=ECOG-WufAa6d3s8kjwlsVWeX36Up20eOvmQ937k_XjU,7533
|
|
2
2
|
pyopenapi_gen/__main__.py,sha256=4-SCaCNhBd7rtyRK58uoDbdl93J0KhUeajP_b0CPpLE,110
|
|
3
3
|
pyopenapi_gen/cli.py,sha256=9T_XF3-ih_JlM_BOkmHft-HoMCGOqL5UrnAHBJ0fb5w,2320
|
|
4
4
|
pyopenapi_gen/http_types.py,sha256=EMMYZBt8PNVZKPFu77TQija-JI-nOKyXvpiQP9-VSWE,467
|
|
@@ -18,7 +18,7 @@ pyopenapi_gen/core/postprocess_manager.py,sha256=Ia4H47lInhVxkHnDB46t4U-6BLpLXzh
|
|
|
18
18
|
pyopenapi_gen/core/schemas.py,sha256=Ngehd-Aj4Drs_5i7eL0L5Eu1B_kfT4qxL94TJ_H_I7w,5523
|
|
19
19
|
pyopenapi_gen/core/streaming_helpers.py,sha256=5fkzH9xsgzZWOTKFrZpmje07S7n7CcOpjteb5dig7ds,2664
|
|
20
20
|
pyopenapi_gen/core/telemetry.py,sha256=LNMrlrUNVcp591w9cX4uvzlFrPB6ZZoGRIuCOHlDCqA,2296
|
|
21
|
-
pyopenapi_gen/core/utils.py,sha256
|
|
21
|
+
pyopenapi_gen/core/utils.py,sha256=VK2TojBe6esfbhSy87kpra4Cguc0iv5teD-T7beI43Q,15435
|
|
22
22
|
pyopenapi_gen/core/warning_collector.py,sha256=DYl9D7eZYs04mDU84KeonS-5-d0aM7hNqraXTex31ss,2799
|
|
23
23
|
pyopenapi_gen/core/auth/base.py,sha256=E2KUerA_mYv9D7xulUm-lenIxqZHqanjA4oRKpof2ZE,792
|
|
24
24
|
pyopenapi_gen/core/auth/plugins.py,sha256=u4GZTykoxGwGaWAQyFeTdPKi-pSK7Dp0DCeg5RsrSw4,3446
|
|
@@ -112,8 +112,8 @@ pyopenapi_gen/visit/endpoint/__init__.py,sha256=DftIZSWp6Z8jKWoJE2VGKL4G_5cqwFXe
|
|
|
112
112
|
pyopenapi_gen/visit/endpoint/endpoint_visitor.py,sha256=1aS0i2D_Y-979_7aBd0W6IS2UVO6wMujsMMw8Qt8PRE,3574
|
|
113
113
|
pyopenapi_gen/visit/endpoint/generators/__init__.py,sha256=-X-GYnJZ9twiEBr_U0obW8VuSoY6IJmYaxinn-seMzA,50
|
|
114
114
|
pyopenapi_gen/visit/endpoint/generators/docstring_generator.py,sha256=_VpRabZ2g_N42TTWGI6gtPxqzlZD65dOHm8U_YvtWbQ,5891
|
|
115
|
-
pyopenapi_gen/visit/endpoint/generators/endpoint_method_generator.py,sha256
|
|
116
|
-
pyopenapi_gen/visit/endpoint/generators/overload_generator.py,sha256=
|
|
115
|
+
pyopenapi_gen/visit/endpoint/generators/endpoint_method_generator.py,sha256=-Hpae2H1gD4DbBb5LikvAw1rI_cUTaGZV8l4OgI9EbE,10234
|
|
116
|
+
pyopenapi_gen/visit/endpoint/generators/overload_generator.py,sha256=XijowsP3SS6kJrX3Yq1h2foO5_Nranzrels3N0hinCQ,9347
|
|
117
117
|
pyopenapi_gen/visit/endpoint/generators/request_generator.py,sha256=MKtZ6Fa050gCgqAGhXeo--p_AzqV9RmDd8e4Zvglgo0,5349
|
|
118
118
|
pyopenapi_gen/visit/endpoint/generators/response_handler_generator.py,sha256=Jb_8hRQY1OfpThupa7UdCNxa712m3WaeNIbLhlYk1bg,24193
|
|
119
119
|
pyopenapi_gen/visit/endpoint/generators/signature_generator.py,sha256=ENi34Rf2x1Ijtvca652ihV9L2UUT1O2SEsG-66Pm_Z8,3873
|
|
@@ -126,8 +126,8 @@ pyopenapi_gen/visit/model/alias_generator.py,sha256=wEMHipPA1_CFxvQ6CS9j4qgXK93s
|
|
|
126
126
|
pyopenapi_gen/visit/model/dataclass_generator.py,sha256=L794s2yyYUO__akGd120NJMV7g2xqiPfQyZo8CduIVM,14426
|
|
127
127
|
pyopenapi_gen/visit/model/enum_generator.py,sha256=AXqKUFuWUUjUF_6_HqBKY8vB5GYu35Pb2C2WPFrOw1k,10061
|
|
128
128
|
pyopenapi_gen/visit/model/model_visitor.py,sha256=TC6pbxpQiy5FWhmQpfllLuXA3ImTYNMcrazkOFZCIyo,9470
|
|
129
|
-
pyopenapi_gen-0.
|
|
130
|
-
pyopenapi_gen-0.
|
|
131
|
-
pyopenapi_gen-0.
|
|
132
|
-
pyopenapi_gen-0.
|
|
133
|
-
pyopenapi_gen-0.
|
|
129
|
+
pyopenapi_gen-0.21.0.dist-info/METADATA,sha256=1pV5cwvDDwbov58u-7Ibb-H3iEvt06lM-QvOkFts270,20551
|
|
130
|
+
pyopenapi_gen-0.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
131
|
+
pyopenapi_gen-0.21.0.dist-info/entry_points.txt,sha256=gxSlNiwom50T3OEZnlocA6qRjGdV0bn6hN_Xr-Ub5wA,56
|
|
132
|
+
pyopenapi_gen-0.21.0.dist-info/licenses/LICENSE,sha256=UFAyTWKa4w10-QerlJaHJeep7G2gcwpf-JmvI2dS2Gc,1088
|
|
133
|
+
pyopenapi_gen-0.21.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|