chore: sync with SDK generator#289
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:
WalkthroughThis PR extracts SDK version management into a dedicated module, refactors constants to import from it, updates release and generator configurations accordingly, applies consistent multi-line parameter list formatting across API endpoint methods, and adjusts documentation spacing. ChangesVersion Management Extraction and SDK Code Formatting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 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)
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #289 +/- ##
=======================================
Coverage 69.92% 69.93%
=======================================
Files 141 142 +1
Lines 10768 10774 +6
=======================================
+ Hits 7530 7535 +5
- Misses 3238 3239 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
74c82c7 to
5142b9f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
openfga_sdk/api/open_fga_api.py (1)
657-663: ⚡ Quick winAdd a regression test for the new
create_storebody guard.Line 657 introduces new client-side validation behavior; please add a unit test that asserts
ApiValueErrorwhenbody=Noneandclient_side_validation=Trueto cover this branch.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openfga_sdk/api/open_fga_api.py` around lines 657 - 663, Add a regression unit test for the create_store client-side validation: call OpenFGAApi.create_store (or the containing API class used in tests) with body=None while forcing api_client.client_side_validation=True and assert that ApiValueError is raised; ensure the test sets up an API client instance (or mock) with client_side_validation enabled and targets the create_store method to cover the branch introduced around the ApiValueError check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openfga_sdk/_version.py`:
- Line 18: Replace the hardcoded USER_AGENT string with one constructed from the
single source of truth SDK_VERSION to avoid duplication: reference SDK_VERSION
when building USER_AGENT (e.g., set USER_AGENT to "openfga-sdk
python/{SDK_VERSION}"), keep the x-release-please-version marker on SDK_VERSION
(not on USER_AGENT), and ensure the Final[str] typing for USER_AGENT and
SDK_VERSION remains intact so the runtime value is derived from SDK_VERSION
rather than duplicated.
---
Nitpick comments:
In `@openfga_sdk/api/open_fga_api.py`:
- Around line 657-663: Add a regression unit test for the create_store
client-side validation: call OpenFGAApi.create_store (or the containing API
class used in tests) with body=None while forcing
api_client.client_side_validation=True and assert that ApiValueError is raised;
ensure the test sets up an API client instance (or mock) with
client_side_validation enabled and targets the create_store method to cover the
branch introduced around the ApiValueError check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 90a0b58f-9cb1-4b6a-9b5b-11f0003eebca
📒 Files selected for processing (7)
.openapi-generator-ignore.openapi-generator/FILESREADME.mdopenfga_sdk/_version.pyopenfga_sdk/api/open_fga_api.pyopenfga_sdk/constants.pyrelease-please-config.json
💤 Files with no reviewable changes (1)
- .openapi-generator/FILES
| SDK_VERSION: Final[str] = "0.10.3" # x-release-please-version | ||
|
|
||
| # User agent used in HTTP requests. | ||
| USER_AGENT: Final[str] = "openfga-sdk python/0.10.3" # x-release-please-version |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Avoid hardcoding the version string in USER_AGENT.
The version 0.10.3 is duplicated in both SDK_VERSION and USER_AGENT. While the x-release-please-version markers should keep them synchronized, constructing USER_AGENT from SDK_VERSION would eliminate duplication and reduce the risk of inconsistency if the release automation fails or is bypassed.
♻️ Proposed refactor
# User agent used in HTTP requests.
-USER_AGENT: Final[str] = "openfga-sdk python/0.10.3" # x-release-please-version
+USER_AGENT: Final[str] = f"openfga-sdk python/{SDK_VERSION}"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| USER_AGENT: Final[str] = "openfga-sdk python/0.10.3" # x-release-please-version | |
| USER_AGENT: Final[str] = f"openfga-sdk python/{SDK_VERSION}" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@openfga_sdk/_version.py` at line 18, Replace the hardcoded USER_AGENT string
with one constructed from the single source of truth SDK_VERSION to avoid
duplication: reference SDK_VERSION when building USER_AGENT (e.g., set
USER_AGENT to "openfga-sdk python/{SDK_VERSION}"), keep the
x-release-please-version marker on SDK_VERSION (not on USER_AGENT), and ensure
the Final[str] typing for USER_AGENT and SDK_VERSION remains intact so the
runtime value is derived from SDK_VERSION rather than duplicated.
Description
Sync with generator changes
whitespace formatting in open_fga_api.py, adds body validation for create_store to match other methods, and removes constants.py from generated files as the version is now managed by release-please.
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
mainSummary by CodeRabbit
Chores
Documentation