feat(sdk): add ergonomic Resource constructors for authorization#354
feat(sdk): add ergonomic Resource constructors for authorization#354marythought merged 2 commits intomainfrom
Conversation
Add Resources utility class with forAttributeValues and forRegisteredResourceValueFqn helpers to reduce boilerplate when building Resource objects for authorization calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
|
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 59 minutes and 38 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)
✨ 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 a new Resources utility class in the Java SDK to simplify the creation of Resource protocol buffer objects. It includes static factory methods forAttributeValues and forRegisteredResourceValueFqn, along with comprehensive unit tests covering various input scenarios and error handling. I have no feedback to provide.
X-Test Results✅ java-v0.13.0 |
Update class-level Javadoc to reference EntityIdentifiers instead of non-existent Go SDK helpers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
|
X-Test Results✅ java-v0.13.0 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
🤖 I have created a release *beep* *boop* --- <details><summary>0.14.0</summary> ## [0.14.0](v0.13.0...v0.14.0) (2026-04-21) ### Features * **sdk:** add ergonomic Resource constructors for authorization ([#354](#354)) ([9e05ca2](9e05ca2)) ### Bug Fixes * **ci:** allow release branch scopes in PR title validation ([#349](#349)) ([8020a3b](8020a3b)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
## Summary - Add `### Resource` section documenting helper functions for all 3 SDKs (`ForAttributeValues`, `ForRegisteredResourceValueFqn`) - Add `<SdkVersion>` annotations with minimum SDK versions: Go v0.17.0, Java v0.14.0, JS v0.15.0 - Update GetDecision examples (Go, Java, JS) to use helpers instead of verbose proto construction - Update Type Reference Resource section with tabbed helper examples - Add note about `ephemeralId` not being set by helpers (relevant for GetDecisionBulk) Based on #303 (SdkVersion component + EntityIdentifier annotations). **Companion PRs (SDK implementations):** - Go: opentdf/platform#3337 - Java: opentdf/java-sdk#354 - JavaScript: opentdf/web-sdk#921 ## Test plan - [ ] `npm run build` passes - [ ] Visual review of rendered authorization page - [ ] CI checks pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Enhanced authorization docs with a new Resource section describing attribute-value and registered-resource formats, plus language-specific helper APIs and “without helpers” manual examples. * Updated GetDecision/GetDecisionBulk/GetEntitlements parameter docs to link entity/resource types and note Resource helper usage. * Rewrote multi-language GetDecision samples (Go/Java/JavaScript) to use Resource/Entity helper constructors. * Added Go TDFObject type reference and minor Go example ctx initialization updates. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Mary Dickson <mary.dickson@virtru.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>



Summary
Resourcesutility class withforAttributeValues(String... fqns)andforRegisteredResourceValueFqn(String fqn)helpersEntityIdentifiersfrom feat(sdk): add EntityIdentifier convenience constructors #346Before:
After:
Example — GetDecision authorization call:
Test plan
forAttributeValues(single, multiple, empty-string FQN, empty array throws)forRegisteredResourceValueFqn(valid + empty string)🤖 Generated with Claude Code