From c6435184e48c220f5abaec81afcf1731bdb4cad4 Mon Sep 17 00:00:00 2001 From: detailswes <97790157+Abishek-Newar@users.noreply.github.com> Date: Fri, 23 Jan 2026 18:28:45 +0530 Subject: [PATCH 1/3] fix: OpenFGA SDK doesn't seem to support async_req parameter --- openfga_sdk/client/client.py | 2 ++ openfga_sdk/sync/client/client.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openfga_sdk/client/client.py b/openfga_sdk/client/client.py index aba8943..752e48a 100644 --- a/openfga_sdk/client/client.py +++ b/openfga_sdk/client/client.py @@ -120,6 +120,8 @@ def options_to_kwargs( kwargs["_headers"] = options["headers"] if options.get("retry_params"): kwargs["_retry_params"] = options["retry_params"] + if options.get("async_req") is not None: + kwargs["async_req"] = options["async_req"] return kwargs diff --git a/openfga_sdk/sync/client/client.py b/openfga_sdk/sync/client/client.py index 1efa33f..15cdd86 100644 --- a/openfga_sdk/sync/client/client.py +++ b/openfga_sdk/sync/client/client.py @@ -121,6 +121,8 @@ def options_to_kwargs( kwargs["_headers"] = options["headers"] if options.get("retry_params"): kwargs["_retry_params"] = options["retry_params"] + if options.get("async_req") is not None: + kwargs["async_req"] = options["async_req"] return kwargs From c6b496fdc8b33f008301060e78f77e617bfbca25 Mon Sep 17 00:00:00 2001 From: detailswes <97790157+Abishek-Newar@users.noreply.github.com> Date: Fri, 23 Jan 2026 18:39:11 +0530 Subject: [PATCH 2/3] fixed teh coderabbit mentioned issue --- openfga_sdk/client/client.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openfga_sdk/client/client.py b/openfga_sdk/client/client.py index 752e48a..aba8943 100644 --- a/openfga_sdk/client/client.py +++ b/openfga_sdk/client/client.py @@ -120,8 +120,6 @@ def options_to_kwargs( kwargs["_headers"] = options["headers"] if options.get("retry_params"): kwargs["_retry_params"] = options["retry_params"] - if options.get("async_req") is not None: - kwargs["async_req"] = options["async_req"] return kwargs From 6ac70841f3bc38722ea576d036058f7211ddd9ae Mon Sep 17 00:00:00 2001 From: Abishek Newar Date: Thu, 12 Feb 2026 03:47:31 +0530 Subject: [PATCH 3/3] changes requested as per soulpancake and copilot --- openfga_sdk/client/client.py | 6 ++++-- openfga_sdk/sync/client/client.py | 4 ++-- test/client/client_test.py | 27 +++++++++++++++++++++++++++ test/sync/client/client_test.py | 27 +++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/openfga_sdk/client/client.py b/openfga_sdk/client/client.py index aba8943..67f5f6a 100644 --- a/openfga_sdk/client/client.py +++ b/openfga_sdk/client/client.py @@ -103,8 +103,8 @@ def set_heading_if_not_set( def options_to_kwargs( - options: dict[str, int | str | dict[str, int | str]] | None = None, -) -> dict[str, int | str | dict[str, int | str]]: + options: dict[str, int | str | bool | dict[str, int | str]] | None = None, +) -> dict[str, int | str | bool | dict[str, int | str]]: """ Return kwargs with continuation_token and page_size """ @@ -120,6 +120,8 @@ def options_to_kwargs( kwargs["_headers"] = options["headers"] if options.get("retry_params"): kwargs["_retry_params"] = options["retry_params"] + if options.get("async_req") is not None: + kwargs["async_req"] = options["async_req"] return kwargs diff --git a/openfga_sdk/sync/client/client.py b/openfga_sdk/sync/client/client.py index 15cdd86..ec16f7e 100644 --- a/openfga_sdk/sync/client/client.py +++ b/openfga_sdk/sync/client/client.py @@ -104,8 +104,8 @@ def set_heading_if_not_set( def options_to_kwargs( - options: dict[str, int | str | dict[str, int | str]] | None = None, -) -> dict[str, int | str | dict[str, int | str]]: + options: dict[str, int | str | bool | dict[str, int | str]] | None = None, +) -> dict[str, int | str | bool | dict[str, int | str]]: """ Return kwargs with continuation_token and page_size """ diff --git a/test/client/client_test.py b/test/client/client_test.py index 947134d..45f4272 100644 --- a/test/client/client_test.py +++ b/test/client/client_test.py @@ -244,6 +244,33 @@ async def test_list_stores_with_name(self, mock_request): _request_timeout=ANY, ) + @patch.object(rest.RESTClientObject, "request") + async def test_list_stores_with_async_req(self, mock_request): + """Test that async_req option is correctly propagated to the API call""" + response_body = json.dumps( + { + "stores": [], + "continuation_token": "", + } + ) + + mock_request.return_value = mock_response(response_body, 200) + configuration = self.configuration + + async with OpenFgaClient(configuration) as api_client: + with patch.object( + api_client._api, "list_stores", wraps=api_client._api.list_stores + ) as mock_api_list_stores: + await api_client.list_stores( + options={ + "async_req": True, + } + ) + + mock_api_list_stores.assert_called_once_with( + async_req=True, + ) + @patch.object(rest.RESTClientObject, "request") async def test_create_store(self, mock_request): """Test case for create_store diff --git a/test/sync/client/client_test.py b/test/sync/client/client_test.py index dbffbd0..6ce2563 100644 --- a/test/sync/client/client_test.py +++ b/test/sync/client/client_test.py @@ -243,6 +243,33 @@ def test_list_stores_with_name(self, mock_request): _request_timeout=ANY, ) + @patch.object(rest.RESTClientObject, "request") + def test_list_stores_with_async_req(self, mock_request): + """Test that async_req option is correctly propagated to the API call""" + response_body = json.dumps( + { + "stores": [], + "continuation_token": "", + } + ) + + mock_request.return_value = mock_response(response_body, 200) + configuration = self.configuration + + with OpenFgaClient(configuration) as api_client: + with patch.object( + api_client._api, "list_stores", wraps=api_client._api.list_stores + ) as mock_api_list_stores: + api_client.list_stores( + options={ + "async_req": True, + } + ) + + mock_api_list_stores.assert_called_once_with( + async_req=True, + ) + @patch.object(rest.RESTClientObject, "request") def test_create_store(self, mock_request): """Test case for create_store