pyopenapi-gen 0.21.0__py3-none-any.whl → 0.21.1__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/visit/endpoint/generators/url_args_generator.py +28 -4
- {pyopenapi_gen-0.21.0.dist-info → pyopenapi_gen-0.21.1.dist-info}/METADATA +1 -1
- {pyopenapi_gen-0.21.0.dist-info → pyopenapi_gen-0.21.1.dist-info}/RECORD +7 -7
- {pyopenapi_gen-0.21.0.dist-info → pyopenapi_gen-0.21.1.dist-info}/WHEEL +0 -0
- {pyopenapi_gen-0.21.0.dist-info → pyopenapi_gen-0.21.1.dist-info}/entry_points.txt +0 -0
- {pyopenapi_gen-0.21.0.dist-info → pyopenapi_gen-0.21.1.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.21.
|
|
53
|
+
__version__: str = "0.21.1"
|
|
54
54
|
|
|
55
55
|
# ---------------------------------------------------------------------------
|
|
56
56
|
# Lazy-loading and autocompletion support (This part remains)
|
|
@@ -43,17 +43,22 @@ class EndpointUrlArgsGenerator:
|
|
|
43
43
|
# writer.write_line("# No query parameters to write") # Optional: for clarity during debugging
|
|
44
44
|
return
|
|
45
45
|
|
|
46
|
+
# Import DataclassSerializer since we use it for parameter serialization
|
|
47
|
+
context.add_import(f"{context.core_package_name}.utils", "DataclassSerializer")
|
|
48
|
+
|
|
46
49
|
for i, p in enumerate(query_params_to_write):
|
|
47
50
|
param_var_name = NameSanitizer.sanitize_method_name(p["name"]) # Ensure name is sanitized
|
|
48
51
|
original_param_name = p["original_name"]
|
|
49
52
|
line_end = "," # Always add comma, let formatter handle final one if needed
|
|
50
53
|
|
|
51
54
|
if p.get("required", False):
|
|
52
|
-
writer.write_line(
|
|
55
|
+
writer.write_line(
|
|
56
|
+
f' "{original_param_name}": DataclassSerializer.serialize({param_var_name}){line_end}'
|
|
57
|
+
)
|
|
53
58
|
else:
|
|
54
59
|
# Using dict unpacking for conditional parameters
|
|
55
60
|
writer.write_line(
|
|
56
|
-
f' **({{"{original_param_name}": {param_var_name}}} '
|
|
61
|
+
f' **({{"{original_param_name}": DataclassSerializer.serialize({param_var_name})}} '
|
|
57
62
|
f"if {param_var_name} is not None else {{}}){line_end}"
|
|
58
63
|
)
|
|
59
64
|
|
|
@@ -66,6 +71,10 @@ class EndpointUrlArgsGenerator:
|
|
|
66
71
|
# if ordered_params is the sole source of truth for method params.
|
|
67
72
|
header_params_to_write = [p for p in ordered_params if p.get("param_in") == "header"]
|
|
68
73
|
|
|
74
|
+
# Import DataclassSerializer since we use it for parameter serialization
|
|
75
|
+
if header_params_to_write:
|
|
76
|
+
context.add_import(f"{context.core_package_name}.utils", "DataclassSerializer")
|
|
77
|
+
|
|
69
78
|
for p_info in header_params_to_write:
|
|
70
79
|
param_var_name = NameSanitizer.sanitize_method_name(
|
|
71
80
|
p_info["name"]
|
|
@@ -74,13 +83,15 @@ class EndpointUrlArgsGenerator:
|
|
|
74
83
|
line_end = ","
|
|
75
84
|
|
|
76
85
|
if p_info.get("required", False):
|
|
77
|
-
writer.write_line(
|
|
86
|
+
writer.write_line(
|
|
87
|
+
f' "{original_header_name}": DataclassSerializer.serialize({param_var_name}){line_end}'
|
|
88
|
+
)
|
|
78
89
|
else:
|
|
79
90
|
# Conditional inclusion for optional headers
|
|
80
91
|
# This assumes that if an optional header parameter is None, it should not be sent.
|
|
81
92
|
# If specific behavior (e.g. empty string) is needed for None, logic would adjust.
|
|
82
93
|
writer.write_line(
|
|
83
|
-
f' **({{"{original_header_name}": {param_var_name}}} '
|
|
94
|
+
f' **({{"{original_header_name}": DataclassSerializer.serialize({param_var_name})}} '
|
|
84
95
|
f"if {param_var_name} is not None else {{}}){line_end}"
|
|
85
96
|
)
|
|
86
97
|
|
|
@@ -95,6 +106,19 @@ class EndpointUrlArgsGenerator:
|
|
|
95
106
|
) -> bool:
|
|
96
107
|
"""Writes URL, query, and header parameters. Returns True if header params were written."""
|
|
97
108
|
# Main logic from EndpointMethodGenerator._write_url_and_args
|
|
109
|
+
|
|
110
|
+
# Serialize path parameters before URL construction
|
|
111
|
+
# This ensures enums, dates, and other complex types are converted to strings
|
|
112
|
+
# before f-string interpolation in the URL
|
|
113
|
+
path_params = [p for p in ordered_params if p.get("param_in") == "path"]
|
|
114
|
+
if path_params:
|
|
115
|
+
# Import DataclassSerializer since we use it for parameter serialization
|
|
116
|
+
context.add_import(f"{context.core_package_name}.utils", "DataclassSerializer")
|
|
117
|
+
for p in path_params:
|
|
118
|
+
param_var_name = NameSanitizer.sanitize_method_name(p["name"])
|
|
119
|
+
writer.write_line(f"{param_var_name} = DataclassSerializer.serialize({param_var_name})")
|
|
120
|
+
writer.write_line("") # Blank line after path param serialization
|
|
121
|
+
|
|
98
122
|
url_expr = self._build_url_with_path_vars(op.path)
|
|
99
123
|
writer.write_line(f"url = {url_expr}")
|
|
100
124
|
writer.write_line("") # Add a blank line for readability
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyopenapi-gen
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.1
|
|
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=uPKVj6G1lbzsS8QC9dCe8MBuRL6XKf4r5aw156jlqkU,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
|
|
@@ -117,7 +117,7 @@ pyopenapi_gen/visit/endpoint/generators/overload_generator.py,sha256=XijowsP3SS6
|
|
|
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
|
|
120
|
-
pyopenapi_gen/visit/endpoint/generators/url_args_generator.py,sha256=
|
|
120
|
+
pyopenapi_gen/visit/endpoint/generators/url_args_generator.py,sha256=DWKtgjj9JzaSd6i-7RoAzHo5uMLZ0GjCHpvHG50CbgY,10922
|
|
121
121
|
pyopenapi_gen/visit/endpoint/processors/__init__.py,sha256=_6RqpOdDuDheArqDBi3ykhsaetACny88WUuuAJvr_ME,29
|
|
122
122
|
pyopenapi_gen/visit/endpoint/processors/import_analyzer.py,sha256=ou5pl3S6PXvHrhKeBQraRfK9MTOQE1WUGLeieAVUXRM,3364
|
|
123
123
|
pyopenapi_gen/visit/endpoint/processors/parameter_processor.py,sha256=E0VoygkhU8iCsvH0U-tA6ZZg2Nm3rfr4e17vxqQLH7c,7666
|
|
@@ -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.21.
|
|
130
|
-
pyopenapi_gen-0.21.
|
|
131
|
-
pyopenapi_gen-0.21.
|
|
132
|
-
pyopenapi_gen-0.21.
|
|
133
|
-
pyopenapi_gen-0.21.
|
|
129
|
+
pyopenapi_gen-0.21.1.dist-info/METADATA,sha256=K25EjI3531dEiR-boznZr51FI7mJEJb3T01hQSTl-8Y,20551
|
|
130
|
+
pyopenapi_gen-0.21.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
131
|
+
pyopenapi_gen-0.21.1.dist-info/entry_points.txt,sha256=gxSlNiwom50T3OEZnlocA6qRjGdV0bn6hN_Xr-Ub5wA,56
|
|
132
|
+
pyopenapi_gen-0.21.1.dist-info/licenses/LICENSE,sha256=UFAyTWKa4w10-QerlJaHJeep7G2gcwpf-JmvI2dS2Gc,1088
|
|
133
|
+
pyopenapi_gen-0.21.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|