Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support passing consistency parameter #113

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

ewanharris
Copy link
Member

@ewanharris ewanharris commented Jul 24, 2024

Description

This is an initial attempt at introducing support for the experimental consistency option in the relevant APIs, this is supported on the following APIs:

  • Check
  • List Users
  • List Objects + Streamed List Objects
  • Expand
  • Read

And the following SDK methods

  • list_relations
  • batch_check

It was decided that as this is more of a general request option similar to model id, when using the OpenFGAClient it should be provided via the options object so usage is as follows:

response = await fga_client.check(
	ClientCheckRequest(
		user="user:anne", relation="viewer", object="document:roadmap"
	),
	{ "consistency": ConsistencyPreference.HIGHER_CONSISTENCY },
)

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@ewanharris ewanharris requested review from a team as code owners July 24, 2024 15:23
@ewanharris ewanharris force-pushed the feat/support-consistency-parameter branch from 2cf8c1b to ead3dc1 Compare July 24, 2024 15:24
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 70.47619% with 31 lines in your changes missing coverage. Please review.

Project coverage is 68.74%. Comparing base (360c2e0) to head (4af82ea).

Files Patch % Lines
openfga_sdk/models/consistency_preference.py 38.00% 31 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #113      +/-   ##
==========================================
+ Coverage   68.72%   68.74%   +0.01%     
==========================================
  Files         119      120       +1     
  Lines        9665     9770     +105     
==========================================
+ Hits         6642     6716      +74     
- Misses       3023     3054      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ewanharris ewanharris marked this pull request as draft July 24, 2024 15:28
@ewanharris ewanharris marked this pull request as ready for review July 25, 2024 13:23
@ewanharris ewanharris force-pushed the feat/support-consistency-parameter branch from ead3dc1 to 4af82ea Compare July 25, 2024 14:11
@rhamzeh rhamzeh added this pull request to the merge queue Jul 31, 2024
Merged via the queue into main with commit 862750b Jul 31, 2024
17 checks passed
@rhamzeh rhamzeh deleted the feat/support-consistency-parameter branch July 31, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants