fix: OpenFGA SDK doesn't seem to support async_req parameter#253
fix: OpenFGA SDK doesn't seem to support async_req parameter#253Abishek-Newar wants to merge 6 commits intoopenfga:mainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughAdds support for passing the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can validate your CodeRabbit configuration file in your editor.If your editor has YAML language server, you can enable auto-completion and validation by adding |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (71.36%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 71.17% 71.36% +0.19%
==========================================
Files 137 137
Lines 11100 11104 +4
==========================================
+ Hits 7900 7924 +24
+ Misses 3200 3180 -20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@openfga_sdk/client/client.py`:
- Around line 123-124: Reject the async_req option in the async client path:
locate the code that checks options.get("async_req") and currently sets
kwargs["async_req"], and change it to raise a clear ValueError (or TypeError)
when options["async_req"] is not None, explaining that async_req is incompatible
with the async client (it triggers self.pool.apply_async and returns a
non-awaitable). Ensure the error message references async_req and the async
client so callers get an explicit, actionable failure instead of a silent
runtime error.
SoulPancake
left a comment
There was a problem hiding this comment.
I see that it initially was added to the async client too
Please update the PR description - Remove the line about async client changes since you've already removed that code
You checked "I have added tests" but there are currently no test files are in the diff
|
hi @SoulPancake , done |
SoulPancake
left a comment
There was a problem hiding this comment.
Hi @Abishek-Newar
What I meant was, you need to add tests to assert this change
Not remove it from the description, I hope that helps 😅
|
@SoulPancake , Sorry, my bad 😅 |
There was a problem hiding this comment.
Pull request overview
This PR aims to expose the underlying OpenAPI-generated async_req threading option via the public client options, by passing it through options_to_kwargs to the generated API methods.
Changes:
- Add passthrough support for
options["async_req"]in the sync client’soptions_to_kwargs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
What problem is being solved?
The
async_reqparameter exists in the lower-levelapi_client.pyto enable threading-based asynchronous requests using Python'sThreadPool. However, this parameter is not exposed through the publicOpenFgaClientAPI because theoptions_to_kwargsfunction doesn't support it, making it inaccessible without using internal APIs.How is it being solved?
Updated the
options_to_kwargsfunction to pass through theasync_reqparameter from user options to the underlying API calls.What changes are made to solve it?
async_reqparameter support inopenfga_sdk/sync/client/client.py(sync client)After this change, users can use
async_reqlike this:References
closes #194
Review Checklist
mainSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.