chore(docs): add Resource constructor helpers and update examples#301
chore(docs): add Resource constructor helpers and update examples#301marythought merged 9 commits intomainfrom
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 17 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded documentation for Resource helpers and replaced manual proto/object constructions in GetDecision/GetDecisionBulk examples with language-specific constructors across Go, Java, and JavaScript; added a Go manual EntityChain example and a Go-only TDFObject type reference. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Code Review
This pull request introduces SDK helper functions for resource construction in Go, Java, and JavaScript, updating the authorization documentation and examples to use these helpers instead of manual construction. The review feedback highlights the need to clarify ephemeralId handling for immutable Java objects, maintain consistent notation in the resource variants table, and update related external code samples for consistency.
|
📄 Preview deployed to https://opentdf-docs-pr-301.surge.sh |
2374648 to
0273065
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
docs/sdks/authorization.mdx (2)
238-241: Java varargs notation uses Go-style trailing....In the Java helper table (and the summary table at line 314), the signatures are rendered as
Resources.forAttributeValues(fqns...). Trailing...after the argument name is Go/C# spread/variadic-call notation; Java varargs are declared asString... fqnsand invoked positionally (e.g.,forAttributeValues(fqn1, fqn2)). The JavaScript row already uses the correct spread form...fqns. Consider either matching the actual Java declaration style or dropping the dots in the descriptor cell for consistency.✏️ Suggested wording
-| `Resources.forAttributeValues(fqns...)` | Resource from attribute value FQNs (e.g. those on a TDF) | +| `Resources.forAttributeValues(String... fqns)` | Resource from attribute value FQNs (e.g. those on a TDF) |And at line 314:
-| Attribute values | `ForAttributeValues(fqns...)` | `Resources.forAttributeValues(fqns...)` | `Resources.forAttributeValues(...fqns)` | +| Attribute values | `ForAttributeValues(fqns...)` | `Resources.forAttributeValues(String... fqns)` | `Resources.forAttributeValues(...fqns)` |🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/sdks/authorization.mdx` around lines 238 - 241, The Java helper signatures in the docs use Go-style trailing dots; update the Java cells for Resources.forAttributeValues and Resources.forRegisteredResourceValueFqn to use proper Java varargs/declaration style (e.g., String... fqns or remove the trailing dots) to match Java syntax and the JavaScript row’s spread notation—ensure both the helper table (Resources.forAttributeValues(fqns...) / Resources.forRegisteredResourceValueFqn(fqn)) and the summary table are changed consistently so Java examples show either "String... fqns" or omit the "..." after the parameter name.
317-319: Consider demonstrating the "helpers + setephemeralId" pattern in GetDecisionBulk.The note correctly tells readers that helpers don't set
ephemeralIdand suggests two options: set it after construction, or use manual construction. The bulk examples (Go 795-820, Java 890-912, JS 945-968) only show the manual path. For Go/Java it's easy to show the helper + assignment (e.g.,r := authorizationv2.ForAttributeValues(...); r.EphemeralId = "resource-1"), which gives readers a less verbose option that matches the rest of the page. Optional — skip if you want to keep the bulk examples self-contained.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/sdks/authorization.mdx` around lines 317 - 319, Add a short example showing the helper + ephemeralId assignment pattern alongside the manual construction in the GetDecisionBulk section: locate the bulk examples for Go (authorizationv2.ForAttributeValues) and Java (the equivalent helper factory), create a minimal snippet that constructs the request with the helper (e.g., assign to variable r) and then sets r.EphemeralId (or r.setEphemeralId(...)) before sending, and place it just before or after the existing manual construction example so readers see the less-verbose option.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/sdks/authorization.mdx`:
- Around line 238-241: The Java helper signatures in the docs use Go-style
trailing dots; update the Java cells for Resources.forAttributeValues and
Resources.forRegisteredResourceValueFqn to use proper Java varargs/declaration
style (e.g., String... fqns or remove the trailing dots) to match Java syntax
and the JavaScript row’s spread notation—ensure both the helper table
(Resources.forAttributeValues(fqns...) /
Resources.forRegisteredResourceValueFqn(fqn)) and the summary table are changed
consistently so Java examples show either "String... fqns" or omit the "..."
after the parameter name.
- Around line 317-319: Add a short example showing the helper + ephemeralId
assignment pattern alongside the manual construction in the GetDecisionBulk
section: locate the bulk examples for Go (authorizationv2.ForAttributeValues)
and Java (the equivalent helper factory), create a minimal snippet that
constructs the request with the helper (e.g., assign to variable r) and then
sets r.EphemeralId (or r.setEphemeralId(...)) before sending, and place it just
before or after the existing manual construction example so readers see the
less-verbose option.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 417df865-74e4-4bdb-9841-40fc4eaae78d
📒 Files selected for processing (1)
docs/sdks/authorization.mdx
6f7f83e to
ed8e7c4
Compare
1288ba1 to
8a15c03
Compare
Add `_, _ = client, context.Background()` to Go setup blocks so they compile without unused variable/import errors. Add "Without helpers" collapsible section to Go EntityIdentifier tab matching Java and JS. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document the new Resource helper functions (ForAttributeValues, ForRegisteredResourceValueFqn) for Go, Java, and JavaScript SDKs. Update GetDecision examples to use the helpers instead of verbose manual proto construction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
- Fix Java varargs notation in helper tables (fqns... → String... fqns) - Add authorizationv2 package prefix to Go entries in summary table - Clarify ephemeralId note for Java's immutable protos (.toBuilder()) - Update code_samples/authorization/get_decision.mdx to use helpers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Go SDK v0.17.0, Java SDK v0.14.0, JS SDK v0.15.0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ed8e7c4 to
af074e2
Compare
…urns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/sdks/authorization.mdx`:
- Around line 362-371: The example uses the wrong client variable—replace
platformClient with the documented platform variable in the call to
platform.v2.authorization.getDecision so the snippet matches the page setup;
keep the Resources.forAttributeValues usage as-is and ensure the context still
imports Resources and calls platform.v2.authorization.getDecision with the same
options.
- Around line 140-168: Remove the duplicated "Without helpers (manual proto
construction)" details block that repeats the Go example for constructing an
authorizationv2.GetDecisionRequest with an
authorizationv2.EntityIdentifier/EntityChain; specifically delete the repeated
<details> block containing the GetDecisionRequest example and the manual
Entity.EmailAddress/EntityChain example (symbols: GetDecisionRequest,
EntityIdentifier, EntityIdentifier_EntityChain, entity.EntityChain,
entity.Entity, Entity_EmailAddress, Entity_CATEGORY_SUBJECT) so the Go tab only
shows the single, original manual-construction example.
In `@docs/sdks/tdf.mdx`:
- Around line 1272-1285: The Type Reference overview at the top of the docs
omits the new TDFObject entry; update the overview list to include TDFObject so
readers can find its Type Reference alongside KASInfo, PolicyObject, Manifest,
and AssertionConfig. Locate the top-of-page overview where Type Reference items
are enumerated and add "TDFObject" (referencing the CreateTDF return type and
methods Manifest() and Size()) so the summary and any table of contents reflect
the new type.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d709d4d4-b489-46a8-b109-bccac7bd4239
📒 Files selected for processing (3)
code_samples/authorization/get_decision.mdxdocs/sdks/authorization.mdxdocs/sdks/tdf.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- code_samples/authorization/get_decision.mdx
…bles Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace `_, _ = client, context.Background()` with `ctx := context.Background()` so the setup block defines the `ctx` variable used by all subsequent Go snippets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…verview - Remove duplicate "Without helpers" details block in Go EntityIdentifier section - Fix JS Resource example to use `platform` instead of `platformClient` - Add TDFObject to Type Reference overview in tdf.mdx Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
### Resourcesection documenting helper functions for all 3 SDKs (ForAttributeValues,ForRegisteredResourceValueFqn)<SdkVersion>annotations with minimum SDK versions: Go v0.17.0, Java v0.14.0, JS v0.15.0ephemeralIdnot being set by helpers (relevant for GetDecisionBulk)Based on #303 (SdkVersion component + EntityIdentifier annotations).
Companion PRs (SDK implementations):
Test plan
npm run buildpasses🤖 Generated with Claude Code
Summary by CodeRabbit