openfga / openfga/python-sdk

get_store should have an optional store_id parameter

Open
#9 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
85
Forks
36
Avg merge
3h 8m
Merged PRs (30d)
3

Description

In the current implementation, get_store return the OpenFGA store specified in the client_api configuration.
Except by listing all the stores with list_stores, I don't see any other way to get a specific store different of the one defined in the configuration.
A way to arrange that would be to add an optional store_id parameter to get_store.

Part of https://github.com/openfga/sdk-generator/issues/118


We should do something similar to what @jimmyjames mentions here:
https://github.com/openfga/java-sdk/issues/150#issuecomment-2666996341

  • for requests that use the storeId in the path, update the request options object to include a storeId
  • In OpenFgaClient, if the options are not null and storeId is non-null and non-empty, use that to build the path. Otherwise, use the storeId configured on the client
  • Update the tests to verify that the storeId can be overridden per request, and that the value on the client is used if not overridden.

In general, it should be pretty similar to how the authorizationModelId is allowed to be overridden per request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OpenFgaClient.get_store and the request options used by client methods. Compare the existing authorizationModelId override behavior, then inspect the related tests to verify that a per-request storeId overrides the configured store and that the configured value remains the fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.