Feat: DSPX-2418 add SDK convenience/discovery method documentation#186
Feat: DSPX-2418 add SDK convenience/discovery method documentation#186marythought wants to merge 6 commits intomainfrom
Conversation
Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
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 developer experience for users of the Go and Java SDKs by introducing comprehensive documentation for new attribute discovery and validation methods. These methods empower developers to proactively manage and verify attributes before data encryption, thereby preventing cryptic runtime errors and improving the robustness of applications interacting with the platform's attribute-based access control. 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 new documentation for SDK convenience methods related to attribute discovery and validation in Go and Java. It also updates the troubleshooting guide to reference these new methods. The changes are well-structured and provide clear examples for both languages. The documentation effectively highlights the benefits of using these methods for early error detection.
| fmt.Printf(" %s (%s)\n", a.GetFqn(), a.GetRule()) | ||
| for _, v := range a.GetValues() { | ||
| fmt.Printf(" value: %s\n", v.GetValue()) | ||
| } | ||
| } |
There was a problem hiding this comment.
The Go example for ListAttributes prints both FQN and rule, and then iterates through values. The Java example only prints FQN and then iterates through values. For consistency and completeness, the Java example should also print the rule of the attribute.
System.out.printf(" %s (%s)%n", a.getFqn(), a.getRule());
for (Value v : a.getValuesList()) {
System.out.printf(" value: %s%n", v.getValue());
}
docs/sdks/troubleshooting.mdx
Outdated
There was a problem hiding this comment.
The troubleshooting guide adds a prevention note for the Go SDK, but the new ValidateAttributes method is also available in the Java SDK. For completeness, a similar prevention note should be added for the Java SDK.
**Prevention (Go SDK)**: Use [`ValidateAttributes`](/sdks/discovery#validateattributes) before calling `CreateTDF` to catch missing attributes immediately instead of at decryption time.
**Prevention (Java SDK)**: Use [`validateAttributes`](/sdks/discovery#validateattributes) before calling `createTDF` to catch missing attributes immediately instead of at decryption time.
Add JavaScript (TypeScript) code examples for all four discovery methods alongside the existing Go and Java tabs. Remove the "Go and Java only" caveat now that the JavaScript SDK also supports these methods. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
…add ValidateAttributeValue Update discovery.mdx to reflect the method rename and new semantics: - Rename "ValidateAttributeValue" section → "ValidateAttributeExists" with updated code examples using the new method name in all 3 SDKs. - Add new "ValidateAttributeValue" section documenting the two-argument form that handles both enumerated and dynamic attribute types, with examples for Go, Java, and JavaScript. - Add tip explaining dynamic vs. enumerated attribute behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and prevention note to all SDKs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
||
| ## ValidateAttributeValue | ||
|
|
||
| Checks that a value string is permitted for a given attribute, handling both **enumerated** and **dynamic** attribute types: |
There was a problem hiding this comment.
Could you please share more about this block here between dynamic and enumerated attributes? I'm not sure I see how that fits into the underlying platform attribute objects (namespace, definition, value) or the any_of, all_of, hierarchy rules of attribute definitions. 🤔
Preview
https://opentdf-docs-preview-dspx-2418.surge.sh/sdks/discovery
Summary
docs/sdks/discovery.mdx) — Documents five conveniencemethods in the Go, Java, and JavaScript SDKs for discovering and validating attributes before
encryption:
ListAttributes— returns all active attributes on the platform with optional namespacefiltering; auto-paginates through all results
ValidateAttributes— checks a list of attribute value FQNs exist before callingCreateTDF, surfacing missing attributes at encryption time rather than decryption time;accepts up to 250 FQNs per call
ValidateAttributeExists— single-FQN convenience wrapper aroundValidateAttributesValidateAttributeValue— fetches an attribute definition and checks whether a candidatevalue is permitted; handles both enumerated attributes (value must match the registered list,
case-insensitively) and dynamic attributes (any non-empty value accepted)
GetEntityAttributes— returns the FQNs assigned to a specific entity (PE or NPE),identified by email, username, client ID, or UUID
docs/sdks/troubleshooting.mdx) — Added a prevention note tothe "Resource Not Found" section pointing to
ValidateAttributesas a way to surface missingattributes at encryption time rather than decryption time
Each method includes side-by-side Go/Java/JavaScript code examples, an end-to-end
"putting it all together" pattern, and a callout noting these wrap the lower-level service
clients available in all SDKs.
Test plan
opentdf-docs-preview-dspx-2418.surge.shnpm run buildcompletes successfully