feat(sdk): DSPX-2418 add discovery convenience methods#339
feat(sdk): DSPX-2418 add discovery convenience methods#339marythought wants to merge 3 commits intomainfrom
Conversation
Summary of ChangesHello @marythought, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the SDK by introducing ergonomic wrapper methods for attribute discovery and validation. These additions streamline developer interaction with the platform's attribute services, providing features like auto-pagination for attribute listings, early validation of FQNs to prevent cryptic decryption failures, and accurate retrieval of entity attributes. The changes aim to improve developer experience and system robustness by aligning the Java SDK with the API shape and security properties established in the Go SDK. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces convenience methods for attribute discovery and validation within the SDK, along with a new AttributeNotFoundException. The changes are well-tested with comprehensive unit tests covering various scenarios and edge cases. The rationale for these changes, including auto-pagination and client-side validation, is clearly articulated and aligns with improving developer experience and system robustness. The new methods enhance the SDK's usability by abstracting verbose RPC calls, making it easier to interact with the platform's attribute services.
X-Test Failure Report |
Move MAX_LIST_ATTRIBUTES_PAGES and MAX_VALIDATE_FQNS to the top of the class body (before instance fields), matching standard Java placement for private static final constants. Rename the lambda parameter in the validateAttributes stream filter from 'fqn' to 'f' to avoid the same name being used for both the enhanced-for loop variable and the lambda parameter in the same method. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
X-Test Failure Report |
The blocking service client methods do not declare `throws ConnectException` in their Java signatures, so catching it is a compilation error. Remove the three try-catch wrappers in listAttributes, validateAttributes, and getEntityAttributes, letting exceptions propagate naturally — consistent with the existing pattern in Autoconfigure.java. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
|
X-Test Results✅ go-main |
There was a problem hiding this comment.
Looks good!
The pagination API is a bit odd to me in that you have data that is both so large you need to paginate it and is of a size where we throw it all into a list but if that really comes up we can deal with it then. I guess that's probably just due to the fact that we paginated everything on the backend.



Summary
SDKclass:listAttributes(),validateAttributes(),validateAttributeExists(),validateAttributeValue(),getEntityAttributes()SDK.AttributeNotFoundException extends SDKException, thrown when FQNs or attributevalues are not found on the platform
DiscoveryTest.javacovering all methods and edge casesRationale
Addresses GitHub discussion developer feedback. Developers currently work with verbose Connect RPC
request/response types through
sdk.getServices().attributes(). These methods provide ergonomicwrappers that:
listAttributes()with a 1,000-page safety cap to prevent unbounded memorygrowth from a misbehaving server
createTDF()so failures happen at encryption timewith a clear message rather than at decryption time with a cryptic "resource not found"
validateAttributeValue(): enforces theregistered value list (case-insensitively) for enumerated attributes; accepts any non-empty
value for dynamic attributes
GetEntitlementsresponse to prevent silent wrong-entity attributereturns
validateAttributes()at 250 FQNs client-side to match the server limitMatches the API shape and security properties of the Go SDK implementation: opentdf/platform#3082.
Test plan
mvn -pl sdk test -Dtest=DiscoveryTest— all 26 tests passmvn -pl sdk test— no regressions in existing test suite