fix(docs): use relation 'reader' instead of 'can_view' in perform-check.mdx#1022
fix(docs): use relation 'reader' instead of 'can_view' in perform-check.mdx#1022maxloge wants to merge 2 commits intoopenfga:mainfrom
Conversation
71eadcb to
ea75a56
Compare
ea75a56 to
77c7488
Compare
|
Thanks @maxloge - will take a look at this soon! |
77c7488 to
6275cad
Compare
…date-tuples The perform-check.mdx example was using relation 'can_view', but the update-tuples page creates relation 'reader'. This brings the two getting-started examples into sync and prevents the ValidationException.
74afce8 to
292594c
Compare
WalkthroughDocumentation update to the Check API response specification clarifying the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the “Getting Started” Check API documentation to better explain how to interpret the allowed field in Check responses and what happens when a relation is not present in the authorization model.
Changes:
- Clarifies when
allowedistruevsfalsein the Check API response. - Adds a note that an undefined relation in the model results in a
400 Bad Requestrather thanallowed: false.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The result's `allowed` field will be: | ||
| - `true` if the relationship exists. | ||
| - `false` if the relation is defined in your model but no matching tuple exists. | ||
|
|
||
| If the relation is *not defined* in your model, the API will return a `400 Bad Request` instead of `false`. |
There was a problem hiding this comment.
The PR title/description indicate that the example relation in this page was changed from can_view to reader, but this diff only updates the explanatory text about the allowed result. If the relation change is already present on the base branch, consider updating the PR title/description to match what’s actually being changed; if not, the intended can_view → reader change appears to be missing from this PR.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/content/getting-started/perform-check.mdx (1)
214-214:⚠️ Potential issue | 🟡 MinorUpdate BatchCheck documentation to match the three-case semantics.
Line 214 still describes only the two-case behavior (true/false) without mentioning that undefined relations will cause a 400 Bad Request error, just like the single Check API. This is inconsistent with the updated documentation on lines 166-170.
📝 Proposed update for consistency
-The result will include an `allowed` field for each authorization check that will return `true` if the relationship exists and `false` if the relationship does not exist. +The result will include an `allowed` field for each authorization check that will return `true` if the relationship exists and `false` if the relation is defined in your model but no matching tuple exists. If any relation is not defined in your model, the API will return a `400 Bad Request` error for the entire batch.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/content/getting-started/perform-check.mdx` at line 214, Update the BatchCheck docs to describe the three-case semantics: instead of saying each authorization check returns only true/false, state that BatchCheck results can be allowed (true), denied (false), or trigger a 400 Bad Request when an undefined relation is referenced (same behavior as the single Check API); edit the sentence referencing "allowed" to include these three outcomes and mention BatchCheck and the single Check API to keep the documentation consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@docs/content/getting-started/perform-check.mdx`:
- Line 214: Update the BatchCheck docs to describe the three-case semantics:
instead of saying each authorization check returns only true/false, state that
BatchCheck results can be allowed (true), denied (false), or trigger a 400 Bad
Request when an undefined relation is referenced (same behavior as the single
Check API); edit the sentence referencing "allowed" to include these three
outcomes and mention BatchCheck and the single Check API to keep the
documentation consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2fc69378-fd57-49d2-b683-56cd9c8a9055
📒 Files selected for processing (1)
docs/content/getting-started/perform-check.mdx
Description
The "Getting Started" use inconsistent relationship names between the
Update Relationship TuplesandPerform a Checksections:update-tuples.mdxreaderperform-check.mdxcan_viewSomeone who follows the instructions in order will receive a
400 Bad Request / ValidationExceptionwhen calling the Check API, even though the example in the doc claims that the result isallowed: true.A user following the example in Python with
would get the following Traceback:
I've also updated the explanation regarding the result since:
returns
returns
and
returns
Fix
In
perform-check.mdx, change the example relation fromcan_viewtoreaderso it matches the tuple created in the previous page and the relation that is used in the other pages of theGetting Startedsection of the documentation.After the fix, the end-to-end example executed by a user reading the documentation linearly using the instructions of the precedent page will works as expected.
The explanation below the example regarding the expected result has also been updated to be more specific.
References
The mismatch is visible on these pages:
Review Checklist
mainSummary by CodeRabbit
allowed: truefor existing relationships,allowed: falsefor defined but missing relationships, and400 Bad Requestfor undefined relations.