fix: handle missing 'type' key in nested object schemas#2861
Open
MaxwellCalkin wants to merge 1 commit intoComposioHQ:nextfrom
Open
fix: handle missing 'type' key in nested object schemas#2861MaxwellCalkin wants to merge 1 commit intoComposioHQ:nextfrom
MaxwellCalkin wants to merge 1 commit intoComposioHQ:nextfrom
Conversation
…aram_schema
Schemas for nested objects may use anyOf/allOf/oneOf/$ref instead of a
top-level 'type' key. Direct dict access prop_info['type'] and
prop_info['title'] would raise KeyError in those cases (e.g. Dropbox
SEARCH_FILE_OR_FOLDER with an 'options' parameter).
Changes:
- prop_info['type'] -> prop_info.get('type')
- prop_info['title'] -> prop_info.get('title', prop_name)
- FALLBACK_VALUES[prop_type] -> FALLBACK_VALUES.get(prop_type)
- When prop_type is None, delegate to json_schema_to_pydantic_type()
which already handles all combiner schemas correctly
Fixes ComposioHQ#2459
|
@MaxwellCalkin is attempting to deploy a commit to the Composio Team on Vercel. A member of the Team first needs to authorize it. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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 #2459
When executing
DROPBOX_SEARCH_FILE_OR_FOLDERwith the optionaloptionsparameter, the SDK crashes withKeyError: 'type'before the API request is even sent. This happens becausepydantic_model_from_param_schema()uses direct dictionary access (prop_info["type"],prop_info["title"]) on schema entries that may not have a top-leveltypekey — nested object schemas can useanyOf,allOf,oneOf, or$refinstead.Changes in
python/composio/utils/shared.pyprop_info["type"]→prop_info.get("type")— preventsKeyErroron schemas withouttypeprop_info["title"]→prop_info.get("title", prop_name)— falls back to property name whentitleis absentFALLBACK_VALUES[prop_type]→FALLBACK_VALUES.get(prop_type)— handlesNoneprop_type gracefullyprop_type is None(schema uses combiners instead oftype), delegates tojson_schema_to_pydantic_type()which already handlesanyOf/allOf/oneOfcorrectly:raises KeyErrorfrom docstring since the function no longer raises itBefore
After
This fix is generic — it handles all cases where a schema property lacks a
typekey, not just the Dropbox case.Note: This PR was authored by Claude (AI), operated by @MaxwellCalkin.