polyapi-python 0.3.20.dev4__py3-none-any.whl → 0.3.21.dev0__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.
polyapi/ai_function.py CHANGED
@@ -75,8 +75,7 @@ def render_ai_function(
75
75
 
76
76
 
77
77
  def _normalize_return_type_for_annotation(function_name: str, return_type_name: str) -> str:
78
- if return_type_name == "ReturnType":
79
- return "ReturnType"
78
+ # "ReturnType" lives in a separate module, so it must be qualified (e.g. _SFX.ReturnType).
80
79
  return add_type_import_path(function_name, return_type_name)
81
80
 
82
81
 
polyapi/server.py CHANGED
@@ -75,8 +75,7 @@ def render_server_function(
75
75
 
76
76
 
77
77
  def _normalize_return_type_for_annotation(function_name: str, return_type_name: str) -> str:
78
- if return_type_name == "ReturnType":
79
- return "ReturnType"
78
+ # "ReturnType" lives in a separate module, so it must be qualified (e.g. _SFX.ReturnType).
80
79
  return add_type_import_path(function_name, return_type_name)
81
80
 
82
81
 
polyapi/utils.py CHANGED
@@ -102,7 +102,8 @@ def normalize_cross_language_type(type_name: str) -> str:
102
102
  normalized = [normalize_cross_language_type(part) for part in parts]
103
103
  return " | ".join(normalized) if normalized else "Any"
104
104
 
105
- if value == "ReturnType" or value.startswith("ReturnType<") or "typeof" in value:
105
+ # Only TS's ReturnType<...>/typeof syntax falls back to Any, not our own "ReturnType" name.
106
+ if value.startswith("ReturnType<") or "typeof" in value:
106
107
  return "Any"
107
108
 
108
109
  return primitive_map.get(value, value)
@@ -220,8 +221,12 @@ def get_type_and_def( # noqa: C901
220
221
  return "List", ""
221
222
  elif title and title == "ReturnType" and schema.get("type"):
222
223
  assert isinstance(title, str)
223
- schema_type = schema.get("type", "Any")
224
- root_type, generated_code = wrapped_generate_schema_types(schema, schema_type, "Dict") # type: ignore
224
+ # Use `title` as the class name, not schema["type"] (e.g. "object" collides with dict).
225
+ root_type, generated_code = wrapped_generate_schema_types(schema, title, "Dict") # type: ignore
226
+ if f"class {root_type}(" not in generated_code:
227
+ # A property-less object schema (e.g. bare {"type": "object"}) generates no
228
+ # class at all, so root_type would reference a name that doesn't exist.
229
+ return "Dict", ""
225
230
  return (map_primitive_types(root_type), "") if is_primitive(root_type) else (root_type, generated_code) # type: ignore
226
231
  elif title:
227
232
  assert isinstance(title, str)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.20.dev4
3
+ Version: 0.3.21.dev0
4
4
  Summary: The Python SDK for the integration platform PolyAPI
5
5
  Author-email: PolyAPI <support@polyapi.io>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  polyapi/__init__.py,sha256=oEijoOVghgeEbwqtWK_74QU38HBDt4THXHBbsortJ1w,5505
2
2
  polyapi/__main__.py,sha256=V4zhAh_YGxno5f_KSrlkELxcuDh9bR3WSd0n-2r-qQQ,93
3
- polyapi/ai_function.py,sha256=GvJKpBZFbI11y9JAKTHXMkztbMHZxNTfL37LLbGKmwI,3017
3
+ polyapi/ai_function.py,sha256=ZvB0ojfDCa4Y7Qe-iwNXdhoR0f5f-wPKu6UwDIxeOgE,3043
4
4
  polyapi/api.py,sha256=CzqX99GekhQJVqAAWlL03hUenIi_5iTln9cWgQzz6Ko,2784
5
5
  polyapi/auth.py,sha256=l0pGAoYvEWqa2TMsrM9GS8imXu3GsWvpn4eFPy1vksI,6195
6
6
  polyapi/cli.py,sha256=V3586ElV1927u2AhQZAo_4UYKoJPqE8lz6b3_gJfMj0,11918
@@ -22,14 +22,14 @@ polyapi/prepare.py,sha256=DBlrQu_A0PqdaQ3KlMs-C6PkV3qncatkAiBlC7j2hnk,7441
22
22
  polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  polyapi/rendered_spec.py,sha256=J2Num7MXnW_mKAe2MSVIL1coWopNYZ-6nNNwQRfseV0,2262
24
24
  polyapi/schema.py,sha256=SPO5GDvIE1BjRfJR89vJMEGCXERfEbhNXQm2A05UAOc,6959
25
- polyapi/server.py,sha256=_14lP4_BmRYMBXwaqXVWmiSTHH3h7ecCHxSalM9UiSc,3049
25
+ polyapi/server.py,sha256=OFyMiNT8z4393e0hD7UzMQMpH1dqFpZGSUe5dzA0aEY,3075
26
26
  polyapi/sync.py,sha256=t0Khh8B5GylxB7KWRP_xvkrvkuyVarSLCOvtmaz7lcc,6766
27
27
  polyapi/typedefs.py,sha256=UeAdyYrgqxrvBRkjisK_xgzQmuTePPvOM74HKf1y0II,5656
28
- polyapi/utils.py,sha256=LUqTkbb0b7y3gjsOU-WO1LVYaTMyExTGpYjKY8wVKg8,16300
28
+ polyapi/utils.py,sha256=UOVNZCUHfPmZRUwOBZ1PblUjT0G_MEH4Qxc0p32FbPQ,16703
29
29
  polyapi/variables.py,sha256=hfSDPGQK6YphNCa9MqE0W88WIFfqCQWgpBDWkExMq-A,7582
30
30
  polyapi/webhook.py,sha256=0ceLwHNjNd2Yx_8MX5jOIxiQ5Lwhy2pe81ProAuKon0,5108
31
- polyapi_python-0.3.20.dev4.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
32
- polyapi_python-0.3.20.dev4.dist-info/METADATA,sha256=wYIJAgguqGC3FNXxYZHtQcLtumtopR5vf29f4X7W9rI,7737
33
- polyapi_python-0.3.20.dev4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
34
- polyapi_python-0.3.20.dev4.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
35
- polyapi_python-0.3.20.dev4.dist-info/RECORD,,
31
+ polyapi_python-0.3.21.dev0.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
32
+ polyapi_python-0.3.21.dev0.dist-info/METADATA,sha256=aTdgr55aQtrAJRZbXeE7VYJ1iwJaAdyZDkxXp20c1b0,7737
33
+ polyapi_python-0.3.21.dev0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
34
+ polyapi_python-0.3.21.dev0.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
35
+ polyapi_python-0.3.21.dev0.dist-info/RECORD,,