Skip to content

default to any if type not found in schema#1888

Merged
wjayesh merged 2 commits intonextfrom
fix/add-default-any-type-if-schema-invalid
Sep 4, 2025
Merged

default to any if type not found in schema#1888
wjayesh merged 2 commits intonextfrom
fix/add-default-any-type-if-schema-invalid

Conversation

@wjayesh
Copy link
Copy Markdown
Contributor

@wjayesh wjayesh commented Sep 3, 2025

Fix: Support Pydantic Any fields in function signature generation

Summary:
Previously, function_signature_from_jsonschema would error if a property schema lacked a type field (which happens for typing.Any in Pydantic). This PR treats such cases as typing.Any, matching JSON Schema and Pydantic intent.

Risks & Safety:

  • ✅ Semantically correct: JSON Schema omitting type = "any type allowed" → Any
  • ✅ Only affects previously failing cases (e.g., flexible API fields)
  • ✅ Type safety is preserved for all typed fields
  • ⚠️ Minimal risk: could mask malformed schemas, but Pydantic auto-generates these, so unlikely

Tested:

  • Failing case (Confluence API with Any field) now works
  • Typed fields and signatures remain correct

Files:

  • composio/utils/openapi.py

@wjayesh wjayesh requested a review from haxzie as a code owner September 3, 2025 12:38
@wjayesh wjayesh merged commit b555efc into next Sep 4, 2025
5 checks passed
@wjayesh wjayesh deleted the fix/add-default-any-type-if-schema-invalid branch September 4, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants