Skip to content

Commit 3538ae1

Browse files
committed
chore: Migrate CI to sonatype central portal
1 parent eb13ccd commit 3538ae1

10 files changed

Lines changed: 76 additions & 23 deletions

File tree

.github/workflows/fossa.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
run: ./gradlew build
2424

2525
- name: Run FOSSA scan and upload build data
26-
uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
26+
uses: fossas/fossa-action@c0a7d013f84c8ee5e910593186598625513cc1e4 # v1.6.0
2727
with:
2828
api-key: ${{ secrets.FOSSA_API_KEY }}
2929
branch: ${{ github.ref_name }}
3030

3131
- name: Run FOSSA tests
32-
uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
32+
uses: fossas/fossa-action@c0a7d013f84c8ee5e910593186598625513cc1e4 # v1.6.0
3333
with:
3434
api-key: ${{ secrets.FOSSA_API_KEY }}
3535
run-tests: true

.github/workflows/main.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ jobs:
2626
cache: gradle
2727

2828
- name: Set up Gradle
29-
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
29+
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
3030

3131
- name: Test and Build with Gradle
3232
run: |
3333
./gradlew build test-integration
3434
3535
- if: matrix.java == 11
3636
name: Upload coverage to Codecov
37-
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
37+
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
3838
continue-on-error: true
3939
with:
4040
token: ${{ secrets.CODECOV_TOKEN }}
@@ -59,10 +59,10 @@ jobs:
5959
distribution: "temurin"
6060

6161
- name: Validate Gradle wrapper
62-
uses: gradle/actions/wrapper-validation@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
62+
uses: gradle/actions/wrapper-validation@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
6363

6464
- name: Setup Gradle
65-
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
65+
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
6666

6767
# Tasks created by https://github.com/gradle-nexus/publish-plugin
6868
- name: Publish package
@@ -92,10 +92,10 @@ jobs:
9292
distribution: "temurin"
9393

9494
- name: Validate Gradle wrapper
95-
uses: gradle/actions/wrapper-validation@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
95+
uses: gradle/actions/wrapper-validation@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
9696

9797
- name: Setup Gradle
98-
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
98+
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
9999

100100
# Tasks created by https://docs.gradle.org/current/userguide/publishing_maven.html
101101
- name: Publish package

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public class Example {
174174
}
175175
```
176176

177-
#### Auth0 Client Credentials
177+
#### Client Credentials
178178

179179
```java
180180
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -605,6 +605,8 @@ Similar to [check](#check), but instead of checking a single user-object relatio
605605

606606
[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/BatchCheck)
607607

608+
> **Note**: The order of `batchCheck` results is not guaranteed to match the order of the checks provided. Use `correlationId` to pair responses with requests.
609+
608610
> Passing `ClientBatchCheckOptions` is optional. All fields of `ClientBatchCheckOptions` are optional.
609611
610612
```java

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
// Quality
55
id 'jacoco'
66
id 'jvm-test-suite'
7-
id 'com.diffplug.spotless' version '7.0.4'
7+
id 'com.diffplug.spotless' version '7.0.3'
88

99
// IDE
1010
id 'idea'
@@ -65,7 +65,7 @@ dependencies {
6565
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
6666
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
6767
implementation "org.openapitools:jackson-databind-nullable:0.2.6"
68-
implementation platform("io.opentelemetry:opentelemetry-bom:1.50.0")
68+
implementation platform("io.opentelemetry:opentelemetry-bom:1.49.0")
6969
implementation "io.opentelemetry:opentelemetry-api"
7070
}
7171

@@ -75,8 +75,8 @@ testing {
7575
useJUnitJupiter()
7676
dependencies {
7777
implementation 'org.assertj:assertj-core:3.27.3'
78-
implementation 'org.mockito:mockito-core:5.18.0'
79-
implementation 'org.junit.jupiter:junit-jupiter:5.13.0'
78+
implementation 'org.mockito:mockito-core:5.17.0'
79+
implementation 'org.junit.jupiter:junit-jupiter:5.12.2'
8080
implementation 'org.wiremock:wiremock:3.13.0'
8181

8282
runtimeOnly 'org.junit.platform:junit-platform-launcher'
@@ -106,8 +106,8 @@ testing {
106106
dependencies {
107107
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
108108
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
109-
implementation "org.testcontainers:junit-jupiter:1.21.1"
110-
implementation "org.testcontainers:openfga:1.21.1"
109+
implementation "org.testcontainers:junit-jupiter:1.21.0"
110+
implementation "org.testcontainers:openfga:1.21.0"
111111
implementation project()
112112
}
113113

example/example1/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'application'
3-
id 'com.diffplug.spotless' version '7.0.4'
4-
id 'org.jetbrains.kotlin.jvm' version '2.1.21'
3+
id 'com.diffplug.spotless' version '7.0.3'
4+
id 'org.jetbrains.kotlin.jvm' version '2.1.20'
55
}
66

77
application {

publish.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ signing {
5151
nexusPublishing {
5252
repositories {
5353
sonatype {
54-
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
55-
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
54+
nexusUrl.set(uri('https://ossrh-staging-api.central.sonatype.com/service/local/'))
55+
snapshotRepositoryUrl.set(uri('https://central.sonatype.com/repository/maven-snapshots/'))
5656
username.set(System.getenv('MAVEN_USERNAME'))
5757
password.set(System.getenv('MAVEN_PASSWORD'))
5858
}

src/main/java/dev/openfga/sdk/api/OpenFgaApi.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,11 @@ private Map<Attribute, String> buildTelemetryAttributes(Map<String, Object> attr
11541154
if (body instanceof BatchCheckRequest) {
11551155
BatchCheckRequest batchCheckRequest = (BatchCheckRequest) body;
11561156

1157+
if (!isNullOrWhitespace(batchCheckRequest.getAuthorizationModelId())) {
1158+
telemetryAttributes.put(
1159+
Attributes.FGA_CLIENT_REQUEST_MODEL_ID, batchCheckRequest.getAuthorizationModelId());
1160+
}
1161+
11571162
if (batchCheckRequest.getChecks() != null) {
11581163
telemetryAttributes.put(
11591164
Attributes.FGA_CLIENT_REQUEST_BATCH_CHECK_SIZE,

src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,23 @@ public CompletableFuture<ClientBatchCheckResponse> batchCheck(
711711

712712
var override = new ConfigurationOverride().addHeaders(options);
713713

714-
Consumer<List<BatchCheckItem>> singleBatchCheckRequest = request -> call(() ->
715-
api.batchCheck(configuration.getStoreId(), new BatchCheckRequest().checks(request), override))
714+
Consumer<List<BatchCheckItem>> singleBatchCheckRequest = request -> call(() -> {
715+
BatchCheckRequest body = new BatchCheckRequest().checks(request);
716+
if (options.getConsistency() != null) {
717+
body.consistency(options.getConsistency());
718+
}
719+
720+
// Set authorizationModelId from options if available; otherwise, use the default from configuration
721+
String authorizationModelId = !isNullOrWhitespace(options.getAuthorizationModelId())
722+
? options.getAuthorizationModelId()
723+
: configuration.getAuthorizationModelId();
724+
725+
if (!isNullOrWhitespace(authorizationModelId)) {
726+
body.authorizationModelId(authorizationModelId);
727+
}
728+
729+
return api.batchCheck(configuration.getStoreId(), body, override);
730+
})
716731
.handleAsync((batchCheckResponseApiResponse, throwable) -> {
717732
Map<String, BatchCheckSingleResult> response =
718733
batchCheckResponseApiResponse.getData().getResult();

src/main/java/dev/openfga/sdk/api/model/AbstractOpenApiSchema.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ public int hashCode() {
137137
public Boolean isNullable() {
138138
if (Boolean.TRUE.equals(isNullable)) {
139139
return Boolean.TRUE;
140-
} else {
141-
return Boolean.FALSE;
142140
}
141+
return Boolean.FALSE;
143142
}
144143
}

src/test/java/dev/openfga/sdk/api/client/OpenFgaClientTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,38 @@ public void shouldSplitBatchesSuccessfully(WireMockRuntimeInfo wireMockRuntimeIn
20402040
assertEquals("relation not found", response3.getError().getMessage());
20412041
}
20422042

2043+
@Test
2044+
public void batchCheck_withOptions() throws Exception {
2045+
// Given
2046+
String postUrl = String.format("https://api.fga.example/stores/%s/batch-check", DEFAULT_STORE_ID);
2047+
String expectedBody = String.format(
2048+
"{\"checks\":[{\"tuple_key\":{\"user\":\"%s\",\"relation\":\"%s\",\"object\":\"%s\"},\"contextual_tuples\":null,\"context\":null,\"correlation_id\":\"cor-1\"}],\"authorization_model_id\":\"%s\",\"consistency\":\"%s\"}",
2049+
DEFAULT_USER,
2050+
DEFAULT_RELATION,
2051+
DEFAULT_OBJECT,
2052+
DEFAULT_AUTH_MODEL_ID,
2053+
ConsistencyPreference.MINIMIZE_LATENCY);
2054+
mockHttpClient.onPost(postUrl).withBody(is(expectedBody)).doReturn(200, "{\"result\":{}}");
2055+
2056+
ClientBatchCheckItem item = new ClientBatchCheckItem()
2057+
.user(DEFAULT_USER)
2058+
.relation(DEFAULT_RELATION)
2059+
._object(DEFAULT_OBJECT)
2060+
.correlationId("cor-1");
2061+
ClientBatchCheckRequest request = new ClientBatchCheckRequest().checks(List.of(item));
2062+
ClientBatchCheckOptions options = new ClientBatchCheckOptions()
2063+
.authorizationModelId(DEFAULT_AUTH_MODEL_ID)
2064+
.consistency(ConsistencyPreference.MINIMIZE_LATENCY);
2065+
2066+
// When
2067+
ClientBatchCheckResponse response = fga.batchCheck(request, options).join();
2068+
2069+
// Then
2070+
mockHttpClient.verify().post(postUrl).withBody(is(expectedBody)).called(1);
2071+
assertNotNull(response);
2072+
assertTrue(response.getResult().isEmpty());
2073+
}
2074+
20432075
/**
20442076
* Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason
20452077
* about and debug a certain relationship.

0 commit comments

Comments
 (0)