Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(schema-converter): silence mypy on null-only-anyOf fallback return
The `return t.Optional[t.Any] if has_null else str` line introduced in 630038ab8 returns a union of `<typing special form>` and `type[str]`, which mypy can't reconcile with the function's declared `t.Type` return. Same `# type: ignore` pattern already used three other times in this function (lines 280, 285, 287) for the identical reason — `t.Optional` isn't a `type[T]`, it's a typing special form. Unblocks Checks/common-checks on this PR and any other PR cut after 630038ab8 landed on next. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
venkat82 committed
May 13, 2026 at 18:26 UTC
16456348669742111cde209823a17b3c6b5babff
1 file changed
+3
-1
python/composio/utils/schema_converter.py
+3
-1
@@ -234,6 +234,8 @@ def _handle_toplevel_combiner(
234
allow_undefined_array_items=True,
235
allow_undefined_type=True,
236
)
237
+ if result is type(None):
238
+ return t.Optional[t.Any]
239
# If result is a type (like a Union or Optional), return it directly
240
# If result is a model class, return it
241
return result
@@ -270,7 +272,7 @@ def _build_union_from_options(options: t.List[t.Dict[str, t.Any]]) -> t.Type:
272
pydantic_types.append(ptype)
273
274
if len(pydantic_types) == 0:
273
- return str # Fallback
275
+ return t.Optional[t.Any] if has_null else str # type: ignore
276
277
if len(pydantic_types) == 1:
278
base_type = pydantic_types[0]