-
Notifications
You must be signed in to change notification settings - Fork 20
feat: merge various fixes #175
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
Conversation
bringing the openfga/sdk-generator#555 from the generator
WalkthroughThe changes update documentation and implementation related to batch check requests in the client. The documentation clarifies result ordering and renames a section. Implementation updates ensure optional parameters like authorization model ID and consistency are included in batch check requests, with corresponding telemetry and a new test verifying this behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant ClientApp
participant OpenFgaClient
participant OpenFgaApi
ClientApp->>OpenFgaClient: batchCheck(request, options)
OpenFgaClient->>OpenFgaClient: Build BatchCheckRequest\n(set checks, consistency, authorizationModelId)
OpenFgaClient->>OpenFgaApi: batchCheck(BatchCheckRequest)
OpenFgaApi->>OpenFgaApi: Collect telemetry attributes\n(including authorizationModelId)
OpenFgaApi-->>OpenFgaClient: BatchCheckResponse
OpenFgaClient-->>ClientApp: ClientBatchCheckResponse
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.38.1)src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #175 +/- ##
============================================
+ Coverage 33.42% 33.66% +0.23%
- Complexity 994 1003 +9
============================================
Files 182 182
Lines 6878 6889 +11
Branches 772 776 +4
============================================
+ Hits 2299 2319 +20
+ Misses 4476 4466 -10
- Partials 103 104 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java (1)
137-142
: Further condenseisNullable()
logicGood removal of the dead
else
, but the whole method can now be expressed in a single line while keeping behaviour identical:- public Boolean isNullable() { - if (Boolean.TRUE.equals(isNullable)) { - return Boolean.TRUE; - } - return Boolean.FALSE; - } + public Boolean isNullable() { + // Autoboxes the primitive boolean back to a `Boolean` + return Boolean.TRUE.equals(isNullable); + }Removes five lines, no functional change.
src/main/java/dev/openfga/sdk/api/OpenFgaApi.java (1)
1154-1161
: Consolidate duplicated “add-model-id” blocksBlocks that add the
FGA_CLIENT_REQUEST_MODEL_ID
attribute now exist for
CheckRequest
,ExpandRequest
,ListObjectsRequest
,ListUsersRequest
,
WriteRequest
, and (new)BatchCheckRequest
.
The code is starting to diverge and makes future updates error-prone.Extracting the repeated fragment into a tiny helper keeps
buildTelemetryAttributes
tight and guarantees identical trimming/validation rules across request
types, e.g.:private void maybeAddModelId(String id, Map<Attribute,String> attrs) { if (!isNullOrWhitespace(id)) { attrs.put(Attributes.FGA_CLIENT_REQUEST_MODEL_ID, id); } }Then each branch becomes a one-liner:
if (body instanceof BatchCheckRequest batch) { maybeAddModelId(batch.getAuthorizationModelId(), telemetryAttributes); ... }Net effect: less duplication, easier maintenance.
README.md (2)
177-177
: Check/adjust anchor references after heading rename
#### Client Credentials
looks good, but any existing Markdown links (e.g., in the Table of Contents or elsewhere in the repo) that still point to#auth0-client-credentials
will now break. Search-and-replace those anchors or add an explicitid
to keep back-compat.
608-609
: Remove stray blank line inside the blockquote
markdownlint
complains (MD028
) because the empty>
line breaks the blockquote:-> **Note**: The order of `batchCheck` results is not guaranteed to match the order of the checks provided. Use `correlationId` to pair responses with requests. -> +> **Note**: The order of `batchCheck` results is not guaranteed to match the order of the checks provided. Use `correlationId` to pair responses with requests.Deleting the blank line resolves the linter warning and keeps the rendered note compact.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
README.md
(2 hunks)src/main/java/dev/openfga/sdk/api/OpenFgaApi.java
(1 hunks)src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java
(1 hunks)src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java
(1 hunks)src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/main/java/dev/openfga/sdk/api/OpenFgaApi.java (1)
src/main/java/dev/openfga/sdk/telemetry/Attributes.java (1)
Attributes
(31-216)
🪛 markdownlint-cli2 (0.17.2)
README.md
609-609: Blank line inside blockquote
(MD028, no-blanks-blockquote)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Test and Build OpenFGA (11)
- GitHub Check: Test and Build OpenFGA (21)
- GitHub Check: Test and Build OpenFGA (17)
- GitHub Check: Analyze (java)
🔇 Additional comments (2)
src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java (1)
2043-2074
: LGTM! Well-structured test for batchCheck with options.This test effectively verifies that the
batchCheck
method properly includes optional parameters (authorizationModelId
andconsistency
) in the request body when provided viaClientBatchCheckOptions
. The test follows established patterns, uses proper mocking, and includes comprehensive assertions for both the HTTP interaction and response validation.src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java (1)
714-730
: LGTM! Well-implemented enhancement for parameter handling.The updated lambda expression properly handles optional
consistency
andauthorizationModelId
parameters in batch check requests. The implementation follows the established pattern used throughout this class, correctly prioritizing option values over configuration defaults and including appropriate null/whitespace checks.This change brings the
batchCheck
method in line with other similar methods likecheck
,expand
, andlistObjects
, ensuring consistent parameter handling across the client.
Description
References
Review Checklist
main
Summary by CodeRabbit
Documentation
Bug Fixes
Tests