`TupleKey` should support `relation=None`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 85
- Forks
- 36
- Avg merge
- 3h 8m
- Merged PRs (30d)
- 3
Description
Checklist
- I have looked into the README and have not found a suitable solution or answer.
- I have looked into the documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have upgraded to the latest version of OpenFGA and the issue still persists.
- I have searched the Slack community and have not found a suitable solution or answer.
- I agree to the terms within the OpenFGA Code of Conduct.
Description
The docs describe how to use the read() method with a TupleKey with no relation set to get a list of all relations a user has with an object. Currently the TupleKey object validation prevents the relation from being None.
Expectation
Not to throw an error when omitting relation or setting to None.
Reproduction
Essentially the code from the docs:
body = TupleKey(
user="user:bob",
object="document:123",
)
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:
body = TupleKey(
user="user:bob",
relation="",
object="document:123",
)
body._relation = None
# call `read(body)` ...
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in openfga_sdk/models/tuple_key.py at the TupleKey validation referenced by the issue, then reproduce the documentation example with read(). Done means constructing TupleKey with relation omitted or set to None no longer raises an error and the relationship query can list the user's relations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authorization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100