pyopenapi-gen 0.14.3__py3-none-any.whl → 0.15.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.
pyopenapi_gen/__init__.py CHANGED
@@ -43,7 +43,7 @@ __all__ = [
43
43
  ]
44
44
 
45
45
  # Semantic version of the generator core – automatically managed by semantic-release.
46
- __version__: str = "0.10.2"
46
+ __version__: str = "0.14.3"
47
47
 
48
48
 
49
49
  # ---------------------------------------------------------------------------
@@ -201,10 +201,24 @@ class OpenAPISchemaResolver(SchemaTypeResolver):
201
201
  # If anything goes wrong with attribute access, assume not a self-reference
202
202
  current_file = None
203
203
 
204
- # Only treat as self-reference if we have a real file path that matches
205
- if current_file and isinstance(current_file, str) and current_file.endswith(f"{module_stem}.py"):
204
+ # Only treat as self-reference if the EXACT filename matches (not just a suffix)
205
+ # Bug fix: Use basename comparison to avoid false positives with similar names
206
+ # e.g., "vector_index_with_embedding_response_data.py" should NOT match "embedding_response_data.py"
207
+ is_self_import = False
208
+ if current_file and isinstance(current_file, str):
209
+ import os
210
+
211
+ current_filename = os.path.basename(current_file)
212
+ expected_filename = f"{module_stem}.py"
213
+ is_self_import = current_filename == expected_filename
214
+
215
+ if is_self_import:
206
216
  # This is a self-import (importing from the same file), so skip the import
207
217
  # and mark as forward reference to require quoting
218
+ logger.debug(
219
+ f"Self-import detected: current_file={current_file}, module_stem={module_stem}, "
220
+ f"class_name={class_name}, returning forward ref WITHOUT import"
221
+ )
208
222
  return ResolvedType(python_type=class_name or "Any", is_optional=not required, is_forward_ref=True)
209
223
 
210
224
  # Use the render context's relative path calculation to determine proper import path
@@ -226,6 +240,10 @@ class OpenAPISchemaResolver(SchemaTypeResolver):
226
240
  # If relative path calculation fails, fall back to the default
227
241
  logger.debug(f"Failed to calculate relative path for {module_stem}, using default: {e}")
228
242
 
243
+ logger.debug(
244
+ f"Adding import for named schema: module={import_module}, name={class_name}, "
245
+ f"current_file={current_file}, module_stem={module_stem}"
246
+ )
229
247
  context.add_import(import_module, class_name or "Any")
230
248
 
231
249
  return ResolvedType(
@@ -144,6 +144,10 @@ class UnifiedTypeService:
144
144
 
145
145
  # Quote forward references BEFORE adding | None so we get: "DataSource" | None not "DataSource | None"
146
146
  if resolved.is_forward_ref and not python_type.startswith('"'):
147
+ logger.debug(
148
+ f'Quoting forward ref: {python_type} -> "{python_type}" '
149
+ f"(is_forward_ref={resolved.is_forward_ref}, needs_import={resolved.needs_import})"
150
+ )
147
151
  python_type = f'"{python_type}"'
148
152
 
149
153
  # Add modern | None syntax if needed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyopenapi-gen
3
- Version: 0.14.3
3
+ Version: 0.15.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=jU5GYbWa4MBDeDzOzwUHl_8eLGtotxRGLj42d2yskUo,3017
1
+ pyopenapi_gen/__init__.py,sha256=AUYdbyW8dbrYxo2DvttZkFO79T5QHsS96P8z4TU8y6U,3017
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
@@ -98,9 +98,9 @@ pyopenapi_gen/types/contracts/types.py,sha256=k3tCjMu6M1zcVXF6jzr-Q9S6LXaMEMoKoO
98
98
  pyopenapi_gen/types/resolvers/__init__.py,sha256=_5kA49RvyOTyXgt0GbbOfHJcdQw2zHxvU9af8GGyNWc,295
99
99
  pyopenapi_gen/types/resolvers/reference_resolver.py,sha256=ue6gw665Wo07POuAg5820A6AXiCVyQY-unfIzGjxrSY,2034
100
100
  pyopenapi_gen/types/resolvers/response_resolver.py,sha256=_W6-Z_SBQ8tDMd_VqveO5AiFs7Od7eAuqevpUIDCT5o,6481
101
- pyopenapi_gen/types/resolvers/schema_resolver.py,sha256=tWNWvCYkXyZ40bzy4ShQJPX2vb_FVgDcrc7tKnWTTwo,22784
101
+ pyopenapi_gen/types/resolvers/schema_resolver.py,sha256=PWw77fPh8SG4i1YD45-cOmjmrA1HQkIz1u75AILlvM0,23617
102
102
  pyopenapi_gen/types/services/__init__.py,sha256=inSUKmY_Vnuym6tC-AhvjCTj16GbkfxCGLESRr_uQPE,123
103
- pyopenapi_gen/types/services/type_service.py,sha256=N_UCyTdt8DRO7FdM7tQT_0G8UJ3OrzqSxTEqEkyrOLg,6784
103
+ pyopenapi_gen/types/services/type_service.py,sha256=3IH0GBLeC-ruokBmhvC8iR5GT5tmFg1n6tcLZYa5TSk,6998
104
104
  pyopenapi_gen/types/strategies/__init__.py,sha256=bju8_KEPNIow1-woMO-zJCgK_E0M6JnFq0NFsK1R4Ss,171
105
105
  pyopenapi_gen/types/strategies/response_strategy.py,sha256=TmXX2YDQB0cQQ7BvRCGSJM6Iu1p0MMJioCi-_8HPCAg,7341
106
106
  pyopenapi_gen/visit/CLAUDE.md,sha256=Rq2e4S74TXv0ua2ZcCrO6cwCCccf3Yph44oVdj1yFPY,8297
@@ -125,8 +125,8 @@ pyopenapi_gen/visit/model/alias_generator.py,sha256=wEMHipPA1_CFxvQ6CS9j4qgXK93s
125
125
  pyopenapi_gen/visit/model/dataclass_generator.py,sha256=L794s2yyYUO__akGd120NJMV7g2xqiPfQyZo8CduIVM,14426
126
126
  pyopenapi_gen/visit/model/enum_generator.py,sha256=AXqKUFuWUUjUF_6_HqBKY8vB5GYu35Pb2C2WPFrOw1k,10061
127
127
  pyopenapi_gen/visit/model/model_visitor.py,sha256=TC6pbxpQiy5FWhmQpfllLuXA3ImTYNMcrazkOFZCIyo,9470
128
- pyopenapi_gen-0.14.3.dist-info/METADATA,sha256=sKA5cB3FHhSkY7wbQs8AlGg9GJc21uitec8EjIXbWtE,14025
129
- pyopenapi_gen-0.14.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
130
- pyopenapi_gen-0.14.3.dist-info/entry_points.txt,sha256=gxSlNiwom50T3OEZnlocA6qRjGdV0bn6hN_Xr-Ub5wA,56
131
- pyopenapi_gen-0.14.3.dist-info/licenses/LICENSE,sha256=UFAyTWKa4w10-QerlJaHJeep7G2gcwpf-JmvI2dS2Gc,1088
132
- pyopenapi_gen-0.14.3.dist-info/RECORD,,
128
+ pyopenapi_gen-0.15.0.dist-info/METADATA,sha256=iRFEkYUsm_-6q06MRBl03b1y3J7Utw1xqiZ7NF6aFSQ,14025
129
+ pyopenapi_gen-0.15.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
130
+ pyopenapi_gen-0.15.0.dist-info/entry_points.txt,sha256=gxSlNiwom50T3OEZnlocA6qRjGdV0bn6hN_Xr-Ub5wA,56
131
+ pyopenapi_gen-0.15.0.dist-info/licenses/LICENSE,sha256=UFAyTWKa4w10-QerlJaHJeep7G2gcwpf-JmvI2dS2Gc,1088
132
+ pyopenapi_gen-0.15.0.dist-info/RECORD,,