Skip to content

Commit 705472f

Browse files
committed
fix(readAuthorizationModel): correctly handle options with no modelID set
1 parent c4b416f commit 705472f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ public CompletableFuture<ClientReadAuthorizationModelResponse> readAuthorization
248248
ClientReadAuthorizationModelOptions options) throws FgaInvalidParameterException {
249249
configuration.assertValid();
250250
String storeId = configuration.getStoreIdChecked();
251-
String authorizationModelId = options.getAuthorizationModelIdChecked();
251+
// Set authorizationModelId from options if available; otherwise, use the default from configuration
252+
String authorizationModelId = !isNullOrWhitespace(options.getAuthorizationModelId())
253+
? options.getAuthorizationModelIdChecked()
254+
: configuration.getAuthorizationModelId();
255+
252256
var overrides = new ConfigurationOverride().addHeaders(options);
253257
return call(() -> api.readAuthorizationModel(storeId, authorizationModelId, overrides))
254258
.thenApply(ClientReadAuthorizationModelResponse::new);

0 commit comments

Comments
 (0)