-
Notifications
You must be signed in to change notification settings - Fork 54
feat(java-sdk): implement individual tuple error handling for non-tra… #573
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
Merged
curfew-marathon
merged 10 commits into
main
from
feature/java-sdk-non-transaction-write-error-handling
Aug 13, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
01741ac
feat(java-sdk): implement individual tuple error handling for non-tra…
curfew-marathon 21dc120
feat(java): Implement chunk-level error handling for non-transactiona…
curfew-marathon 59e69c7
fix: correct method names in Java SDK OpenFgaClient template
curfew-marathon 16409a6
fix: correct TupleKey type compatibility in Java SDK delete operations
curfew-marathon e36fdc0
Remove Issue99 reproduction test from Java template
curfew-marathon e75b6a4
Add comprehensive JavaDoc documentation for write methods
curfew-marathon 95ba4bc
Fix Example1 template: update credential env vars and add duplicate t…
curfew-marathon 9761133
Add settings.gradle.mustache mapping to Java config
curfew-marathon 376b968
Revert "Add settings.gradle.mustache mapping to Java config"
curfew-marathon 319252f
Merge branch 'main' into feature/java-sdk-non-transaction-write-error…
curfew-marathon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
} | ||
rhamzeh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
rootProject.name = '{{artifactId}}' |
253 changes: 231 additions & 22 deletions
253
config/clients/java/template/src/main/api/client/OpenFgaClient.java.mustache
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...g/clients/java/template/src/main/api/client/model/ClientWriteSingleResponse.java.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{>licenseInfo}} | ||
package {{clientPackage}}.model; | ||
|
||
import {{modelPackage}}.TupleKey; | ||
|
||
public class ClientWriteSingleResponse { | ||
private final TupleKey tupleKey; | ||
private final ClientWriteStatus status; | ||
private final Exception error; | ||
|
||
public ClientWriteSingleResponse(TupleKey tupleKey, ClientWriteStatus status) { | ||
this(tupleKey, status, null); | ||
} | ||
|
||
public ClientWriteSingleResponse(TupleKey tupleKey, ClientWriteStatus status, Exception error) { | ||
this.tupleKey = tupleKey; | ||
this.status = status; | ||
this.error = error; | ||
} | ||
|
||
public TupleKey getTupleKey() { | ||
return tupleKey; | ||
} | ||
|
||
public ClientWriteStatus getStatus() { | ||
return status; | ||
} | ||
|
||
public Exception getError() { | ||
return error; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
config/clients/java/template/src/main/api/client/model/ClientWriteStatus.java.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{>licenseInfo}} | ||
package {{clientPackage}}.model; | ||
|
||
public enum ClientWriteStatus { | ||
SUCCESS("success"), | ||
FAILURE("failure"); | ||
|
||
private final String value; | ||
|
||
ClientWriteStatus(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ients/java/template/src/test/api/client/model/ClientWriteSingleResponseTest.java.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{{>licenseInfo}} | ||
package {{clientPackage}}.model; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import org.junit.jupiter.api.Test; | ||
import {{modelPackage}}.TupleKey; | ||
|
||
public class ClientWriteSingleResponseTest { | ||
|
||
@Test | ||
public void testSuccessfulResponse() { | ||
TupleKey tupleKey = new TupleKey() | ||
.user("user:alice") | ||
.relation("viewer") | ||
._object("document:test"); | ||
|
||
ClientWriteSingleResponse response = new ClientWriteSingleResponse(tupleKey, ClientWriteStatus.SUCCESS); | ||
|
||
assertEquals(tupleKey, response.getTupleKey()); | ||
assertEquals(ClientWriteStatus.SUCCESS, response.getStatus()); | ||
assertNull(response.getError()); | ||
} | ||
|
||
@Test | ||
public void testFailedResponse() { | ||
TupleKey tupleKey = new TupleKey() | ||
.user("user:bob") | ||
.relation("editor") | ||
._object("document:test"); | ||
Exception error = new RuntimeException("Test error"); | ||
|
||
ClientWriteSingleResponse response = new ClientWriteSingleResponse(tupleKey, ClientWriteStatus.FAILURE, error); | ||
|
||
assertEquals(tupleKey, response.getTupleKey()); | ||
assertEquals(ClientWriteStatus.FAILURE, response.getStatus()); | ||
assertEquals(error, response.getError()); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
config/clients/java/template/src/test/api/client/model/ClientWriteStatusTest.java.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{>licenseInfo}} | ||
package {{clientPackage}}.model; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class ClientWriteStatusTest { | ||
|
||
@Test | ||
public void testSuccessValue() { | ||
assertEquals("success", ClientWriteStatus.SUCCESS.getValue()); | ||
assertEquals("success", ClientWriteStatus.SUCCESS.toString()); | ||
} | ||
|
||
@Test | ||
public void testFailureValue() { | ||
assertEquals("failure", ClientWriteStatus.FAILURE.getValue()); | ||
assertEquals("failure", ClientWriteStatus.FAILURE.toString()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.