Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix nested schema generation #989

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

kaavee315
Copy link
Contributor

@kaavee315 kaavee315 commented Dec 11, 2024

Important

Update remove_json_ref in abs.py to handle nested JSON schema references with merge_props=True.

  • Behavior:
    • Update remove_json_ref in abs.py to use merge_props=True in jsonref.replace_refs() to handle nested JSON schema references.
  • Misc:
    • No other changes or impacts on other parts of the codebase.

This description was created by Ellipsis for c75e6bb. It will automatically update as commits are pushed.

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 1:42pm

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to c75e6bb in 7 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. python/composio/tools/base/abs.py:43
  • Draft comment:
    Ensure that the merge_props parameter in jsonref.replace_refs is intended and correctly used. This parameter might affect how JSON references are resolved and merged, which could impact the schema generation.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The change in the PR adds a new parameter merge_props=True to the jsonref.replace_refs function call. This parameter is not documented in the PR description, so I need to verify its purpose and impact.

Workflow ID: wflow_O8GMwaX4PrSUCfVX


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@kaavee315 kaavee315 changed the title Fix nested schema generation fix: Fix nested schema generation Dec 11, 2024
@@ -40,6 +40,7 @@ def remove_json_ref(data: t.Dict) -> t.Dict:
jsonref.replace_refs(
obj=data,
lazy_load=False,
merge_props=True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment explaining why merge_props=True is necessary here. This parameter is crucial for handling nested schemas correctly, and documenting this requirement would help future maintainers understand the importance of this setting.

@shreysingla11
Copy link
Collaborator

I've reviewed the changes and here's my assessment:

The change to add merge_props=True to jsonref.replace_refs() is a good fix for handling nested schemas. However, I have a few suggestions for improvement:

  1. Documentation:

    • The remove_json_ref function could benefit from a more detailed docstring explaining its purpose and behavior, especially regarding nested schema handling
    • Consider adding an inline comment explaining why merge_props=True is necessary for future maintainers
  2. Testing:

    • It would be valuable to add test cases specifically for nested schema scenarios to ensure the fix works as intended
    • Consider testing edge cases where schema merging might be complex
  3. Code Quality:

    • The change itself is clean and follows good practices
    • The explicit setting of merge_props=True makes the behavior clear and intentional

Overall, this is a good fix that addresses the nested schema generation issue. The changes are minimal and focused, with low risk. I recommend adding the suggested documentation improvements before merging.

Code Quality Rating: 8/10

  • Pros: Clean fix, explicit parameter setting, backward compatible
  • Areas for improvement: Documentation could be more detailed

@tushar-composio tushar-composio merged commit 3909504 into master Dec 11, 2024
9 of 11 checks passed
@tushar-composio tushar-composio deleted the kaavee/fix_nested_schema branch December 11, 2024 13:56
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.

3 participants