Open jnu opened 3 weeks ago
Hi @jnu - Thanks for raising this! I will transfer this to be an issue in the docs, the SDK docs here are more up to date
https://github.com/openfga/python-sdk?tab=readme-ov-file#read-relationship-tuples
And you would want to do something like
# from openfga_sdk import OpenFgaClient, ReadRequestTupleKey
# Initialize the fga_client
# fga_client = OpenFgaClient(configuration)
# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
body = ReadRequestTupleKey(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
object="document:roadmap",
)
response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
Before we move it, can you clarify:
0.4.0 (but the code in main appears broken)
Is there something else not working for you?
Checklist
Description
The docs describe how to use the
read()
method with aTupleKey
with norelation
set to get a list of all relations a user has with an object. Currently theTupleKey
object validation prevents therelation
from beingNone
.Expectation
Not to throw an error when omitting
relation
or setting toNone
.Reproduction
Essentially the code from the docs:
Working around the validation and submitting the query confirms the behavior describes from the docs (i.e., listing the relations) works as expected:
Issuing a query with a workaround:
OpenFGA SDK version
0.4.0 (but the code in main appears broken)
OpenFGA version
v1.5.0
SDK Configuration
[default options]
Logs
No response
References
No response