fix: handle additionalProperties in json_schema_to_pydantic_type#3105
Open
hashwnath wants to merge 2 commits intoComposioHQ:nextfrom
Open
fix: handle additionalProperties in json_schema_to_pydantic_type#3105hashwnath wants to merge 2 commits intoComposioHQ:nextfrom
hashwnath wants to merge 2 commits intoComposioHQ:nextfrom
Conversation
|
@hashwnath is attempting to deploy a commit to the Composio Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…trict model When additionalProperties is false and no properties are defined, the schema means "only empty objects are valid." Previously this returned bare Dict (too permissive). Now it falls through to create_model_from_schema which produces a strict Pydantic model that rejects extra fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #3087
When a JSON schema defines an object with
additionalPropertiesbut no explicitproperties(e.g.{"type": "object", "additionalProperties": {"type": "string"}}),json_schema_to_pydantic_type()delegates tocreate_model_from_schema()which generates an empty Pydantic model. This causes Pydantic to silently strip all fields during validation, resulting in empty objects like[{}]instead of the expected data.This affects any tool in the catalog whose schema uses
additionalPropertieswithout explicitproperties— includingOUTLOOK_CALENDAR_CREATE_EVENT'sattendees_infofield.Fix
Before delegating to
create_model_from_schema(), check if the object schema hasadditionalPropertiesbut noproperties. In that case, map directly toDict[str, value_type]:{"type": "object", "additionalProperties": {"type": "string"}}→ {}Dict[str, str]{"type": "object", "additionalProperties": {"type": "integer"}}→ {}Dict[str, int]{"type": "object", "additionalProperties": true}→ {}Dict[str, Any]{"type": "object", "properties": {...}}Verification
Using the MRE from the issue: