Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 07:15 UTC
fix(python): handle list-valued type when coercing schema defaults (#5051)
This PR: - fixes #5050: `json_schema_to_model()` crashes with `TypeError: unhashable type: 'list'` for a nullable property such as `{"type": ["string", "null"], "default": "asc"}`. - collects expected types from single names and type arrays, including `anyOf`, `oneOf`, and `allOf` branches, while preserving the existing default-coercion precedence. - adds five regression cases covering nullable string/boolean defaults and all three combiners. - independently reproduces the public model-conversion failure on current `next` and verifies the patched model accepts both string and null values. - passes `.venv/bin/python -m pytest python/tests/test_schema_parser.py -q`: 246 tests, and `.venv/bin/mypy --config-file python/config/mypy.ini python/composio/utils/shared.py`. - passes Ruff check and formatting checks for both changed Python files using `python/config/ruff.toml`. Updated with current `next`. Validation used an isolated environment with the declared `composio-client==2.0.0rc23` and relevant versions from `uv.lock`. Python-only changes do not need a Changeset. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: jkomyno <alberto@composio.dev>