feat(docs): add SDK version annotations & normalize setup sections#303
feat(docs): add SDK version annotations & normalize setup sections#303marythought merged 12 commits intomainfrom
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds a new SdkVersion React component and updates multiple SDK docs to use it; refactors Go setup snippets into complete main programs, renames JS Changes
Sequence Diagram(s)(Skipped — changes are documentation and a UI component; no new multi-component runtime control flow requiring sequence diagrams.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
📄 Preview deployed to https://opentdf-docs-pr-303.surge.sh |
There was a problem hiding this comment.
Code Review
This pull request updates the SDK documentation in docs/sdks/authorization.mdx and docs/sdks/discovery.mdx to include version availability information for Go, Java, and JavaScript SDKs. These notes specify the minimum SDK version required for various authorization and discovery features. I have no feedback to provide as there were no review comments.
4564adc to
c92bcd8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/SdkVersion/index.tsx`:
- Around line 15-36: The component currently renders an <a href=""> when
releaseUrl returns an empty string; update SdkVersion to check the url returned
by releaseUrl(language, version, source) and only render an anchor when url is
truthy, otherwise render the plain text "label v{version}" (no anchor). When
rendering the anchor for external GitHub links, add target="_blank" and
rel="noopener noreferrer". Locate the logic in SdkVersion and adjust the JSX
conditional rendering around url and label/version.
🪄 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: 6138cc9f-596a-43e6-8385-5f2ed53d54c8
📒 Files selected for processing (4)
docs/sdks/authorization.mdxdocs/sdks/discovery.mdxdocs/sdks/obligations.mdxsrc/components/SdkVersion/index.tsx
013af93 to
2b279b9
Compare
a6aad19 to
a5ca09d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 23-41: The snippet as-is causes unused import/variable errors
because context and client are only mentioned in a comment; fix by actually
referencing them: after creating client (sdk.New) assign ctx :=
context.Background() and then mark both as used (for example set _ = ctx and _ =
client) or perform a minimal operation (e.g., log.Printf or pass ctx to a real
call) so imports and variables are consumed; update the package main block
surrounding sdk.New, context, and client to include these references.
🪄 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: baa33d8e-a8db-4294-8414-956b2587e208
📒 Files selected for processing (5)
docs/sdks/authorization.mdxdocs/sdks/discovery.mdxdocs/sdks/obligations.mdxdocs/sdks/tdf.mdxsrc/components/SdkVersion/index.tsx
✅ Files skipped from review due to trivial changes (1)
- docs/sdks/tdf.mdx
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/sdks/discovery.mdx
- src/components/SdkVersion/index.tsx
- docs/sdks/obligations.mdx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/SdkVersion/index.tsx (1)
3-9: Consider tightening theSdkVersionPropstype surface.Two small polish items on the props type:
removalis only meaningful whenstatus === 'deprecated', but the type allows it for any status (including the default'added'), where it is silently ignored (line 43 only reads it inside the deprecated branch). A discriminated union would make misuse a compile error:type SdkVersionProps = | { language: 'go' | 'java' | 'js'; version: string; source: 'opentdf'; status?: 'added' } | { language: 'go' | 'java' | 'js'; version: string; source: 'opentdf'; status: 'deprecated'; removal?: string };The
labelsmap is typedRecord<string, string>(line 11), which defeats thelanguageliteral union — the?? languagefallback at line 39 is therefore dead code. Typing it asRecord<SdkVersionProps['language'], string>makes the lookup total and lets you drop the fallback.Non-blocking; purely a type-safety nit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/SdkVersion/index.tsx` around lines 3 - 9, Tighten SdkVersionProps by turning it into a discriminated union so removal is only allowed when status === 'deprecated' (update the SdkVersionProps type definition to have one branch for status?: 'added' without removal and another branch for status: 'deprecated' with optional removal) and change the labels map typing from Record<string, string> to Record<SdkVersionProps['language'], string> so lookups like labels[language] are total and you can remove the `?? language` fallback; update any usages referencing SdkVersionProps or labels accordingly (e.g., where labels and SdkVersionProps are declared/used in this file).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/SdkVersion/index.tsx`:
- Around line 3-9: Tighten SdkVersionProps by turning it into a discriminated
union so removal is only allowed when status === 'deprecated' (update the
SdkVersionProps type definition to have one branch for status?: 'added' without
removal and another branch for status: 'deprecated' with optional removal) and
change the labels map typing from Record<string, string> to
Record<SdkVersionProps['language'], string> so lookups like labels[language] are
total and you can remove the `?? language` fallback; update any usages
referencing SdkVersionProps or labels accordingly (e.g., where labels and
SdkVersionProps are declared/used in this file).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4ac9d59e-ec10-4f13-9944-1a7f0ca2415d
📒 Files selected for processing (2)
docs/sdks/policy.mdxsrc/components/SdkVersion/index.tsx
✅ Files skipped from review due to trivial changes (1)
- docs/sdks/policy.mdx
Add "Available since" tags with release links to: - 5 discovery methods (ListAttributes, AttributeExists, AttributeValueExists, ValidateAttributes, GetEntityAttributes) - EntityIdentifier constructor helpers in authorization Each language tab links to its own SDK release since Go, Java, and JS ship independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace raw markdown "Available since" lines with a reusable <SdkVersion> component that constructs release URLs from props. dsp-docs can register a no-op version to suppress these cleanly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Supports three modes: - <SdkVersion ... /> — "Available since Go SDK v0.14.0" - <SdkVersion ... status="deprecated" /> — "Deprecated in Go SDK v0.16.0" - <SdkVersion ... status="deprecated" removal="0.18.0" /> — adds "scheduled for removal in v0.18.0" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Render plain text when releaseUrl returns empty string (no broken <a href=""> links) - Add target="_blank" rel="noopener noreferrer" for external GitHub release links Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- authorization.mdx: rename JS `platformClient` to `platform` to match policy, discovery, and obligations pages - tdf.mdx: add sdk.close() reminder to Java setup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t table Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch from "Available since Go SDK v0.16.0" to "Go SDK v0.16.0+" and from "Deprecated in Go SDK v0.16.0, scheduled for removal in v0.17.0" to "Go SDK v0.16.0–v0.17.0 (deprecated)". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
Move <SdkVersion> tags from below the code blocks to directly after the <TabItem> opening, so the version badge appears at the top of each language-specific section. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1288ba1 to
8a15c03
Compare
## 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
Adds SDK version annotations to method signatures using a new
<SdkVersion>MDX component.<SdkVersion>component (src/components/SdkVersion/index.tsx):language(go/java/js),version,source(opentdf)status="deprecated"and optionalremovalprop for deprecation noticesVersion annotations added:
Setup section consistency fixes:
package main, full imports, andfunc main()wrapper to Go setup in discovery + authorizationsdk.close()reminder to discovery + authorizationplatformClient→platformin authorization to match all other pagessdk.close()reminder to tdf.mdx Java setupTest plan
npx docusaurus buildsucceedsvalepasses with 0 errors/warnings/suggestions🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation