Skip to content

feat(docs): add SDK version annotations & normalize setup sections#303

Merged
marythought merged 12 commits intomainfrom
docs/sdk-version-annotations
Apr 22, 2026
Merged

feat(docs): add SDK version annotations & normalize setup sections#303
marythought merged 12 commits intomainfrom
docs/sdk-version-annotations

Conversation

@marythought
Copy link
Copy Markdown
Contributor

@marythought marythought commented Apr 21, 2026

Summary

Adds SDK version annotations to method signatures using a new <SdkVersion> MDX component.

<SdkVersion> component (src/components/SdkVersion/index.tsx):

  • Props: language (go/java/js), version, source (opentdf)
  • Constructs release URLs automatically per language+source
  • Supports status="deprecated" and optional removal prop for deprecation notices
  • Renders as: Go SDK v0.14.0+ or Go SDK v0.16.0–v0.17.0 (deprecated)
  • dsp-docs registers a global no-op version (virtru-corp/dsp-docs#189) so these don't render in DSP documentation

Version annotations added:

  • Discovery methods (ListAttributes, AttributeExists, AttributeValueExists, ValidateAttributes, GetEntityAttributes) — Go v0.14.0, Java v0.13.0, JS v0.10.0
  • EntityIdentifier helpers (ForEmail, ForClientID, ForUserName, ForToken, WithRequestToken) — Go v0.16.0, Java v0.13.0, JS v0.14.0

Setup section consistency fixes:

  • Added package main, full imports, and func main() wrapper to Go setup in discovery + authorization
  • Added Java imports and sdk.close() reminder to discovery + authorization
  • Renamed JS platformClientplatform in authorization to match all other pages
  • Added sdk.close() reminder to tdf.mdx Java setup

Test plan

  • npx docusaurus build succeeds
  • vale passes with 0 errors/warnings/suggestions
  • Verify Surge preview renders version tags correctly inside tabs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added an SDK version availability component used across docs.
  • Documentation

    • Added per-language SDK version metadata to multiple guides.
    • Rewrote Go setup examples into full executable samples.
    • Renamed a JS example client variable for consistency and updated call sites.
    • Added Java cleanup guidance (call close) and clarified obligations usage.
    • Expanded EntityIdentifier docs with a manual construction example.
    • Corrected a documented type reference and improved policy intro links.

@marythought marythought requested review from a team as code owners April 21, 2026 21:13
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55486a2d-43c4-41bc-aace-2dce479e29b5

📥 Commits

Reviewing files that changed from the base of the PR and between cdd61dd and 8a15c03.

📒 Files selected for processing (6)
  • docs/sdks/authorization.mdx
  • docs/sdks/discovery.mdx
  • docs/sdks/obligations.mdx
  • docs/sdks/policy.mdx
  • docs/sdks/tdf.mdx
  • src/components/SdkVersion/index.tsx

📝 Walkthrough

Walkthrough

Adds a new SdkVersion React component and updates multiple SDK docs to use it; refactors Go setup snippets into complete main programs, renames JS platformClientplatform, adds Java sdk.close() comments, and expands EntityIdentifier examples in Go.

Changes

Cohort / File(s) Summary
New UI component
src/components/SdkVersion/index.tsx
Adds SdkVersion React component and SdkVersionProps to render per-language availability text and generate GitHub release links for opentdf source.
Authorization docs
docs/sdks/authorization.mdx
Imports SdkVersion, inserts per-language <SdkVersion> blocks for EntityIdentifier helpers; adds a Go "without helpers" manual construction example; renames JS platformClientplatform and updates call sites.
Discovery docs
docs/sdks/discovery.mdx
Imports SdkVersion and adds per-language tags; rewrites Go setup into package main/main() with error handling; adds Java import/comment about sdk.close().
Obligations docs
docs/sdks/obligations.mdx
Replaces plain "Available since" with SdkVersion for Go example; clarifies obligations use same client/platform as Policy; updates attributeValue type reference to AttributeValue.
TDF docs minor
docs/sdks/tdf.mdx
Adds Java example comment advising callers to call sdk.close() when finished.
Policy docs minor
docs/sdks/policy.mdx
Converts component names to intra-page anchor links and adds obligations to the policy overview.

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

  • dmihalcik-virtru
  • elizabethhealy
  • jp-ayyappan

Poem

🐇 I hopped through docs to pin each line,
Badges for Go, Java, JavaScript shine.
Renamed a client, wrapped main with care,
Manual protos now live there—
Hooray, the SDKs wear their time! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding SDK version annotations and normalizing setup sections across documentation files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/sdk-version-annotations

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

📄 Preview deployed to https://opentdf-docs-pr-303.surge.sh

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@marythought marythought force-pushed the docs/sdk-version-annotations branch from 4564adc to c92bcd8 Compare April 21, 2026 21:44
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 77294e5 and c92bcd8.

📒 Files selected for processing (4)
  • docs/sdks/authorization.mdx
  • docs/sdks/discovery.mdx
  • docs/sdks/obligations.mdx
  • src/components/SdkVersion/index.tsx

Comment thread src/components/SdkVersion/index.tsx
@marythought marythought force-pushed the docs/sdk-version-annotations branch from 013af93 to 2b279b9 Compare April 21, 2026 22:00
@marythought marythought changed the title feat(docs): add SDK version annotations to discovery and authorization feat(docs): add SDK version annotations & normalize setup sections Apr 21, 2026
@marythought marythought force-pushed the docs/sdk-version-annotations branch from a6aad19 to a5ca09d Compare April 21, 2026 23:47
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c92bcd8 and a5ca09d.

📒 Files selected for processing (5)
  • docs/sdks/authorization.mdx
  • docs/sdks/discovery.mdx
  • docs/sdks/obligations.mdx
  • docs/sdks/tdf.mdx
  • src/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

Comment thread docs/sdks/authorization.mdx
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/components/SdkVersion/index.tsx (1)

3-9: Consider tightening the SdkVersionProps type surface.

Two small polish items on the props type:

  1. removal is only meaningful when status === '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 };
  2. The labels map is typed Record<string, string> (line 11), which defeats the language literal union — the ?? language fallback at line 39 is therefore dead code. Typing it as Record<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

📥 Commits

Reviewing files that changed from the base of the PR and between a5ca09d and cdd61dd.

📒 Files selected for processing (2)
  • docs/sdks/policy.mdx
  • src/components/SdkVersion/index.tsx
✅ Files skipped from review due to trivial changes (1)
  • docs/sdks/policy.mdx

Comment thread docs/sdks/authorization.mdx
marythought and others added 12 commits April 22, 2026 12:39
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>
@marythought marythought force-pushed the docs/sdk-version-annotations branch from 1288ba1 to 8a15c03 Compare April 22, 2026 19:40
@marythought marythought merged commit 9fe8f83 into main Apr 22, 2026
8 of 9 checks passed
@marythought marythought deleted the docs/sdk-version-annotations branch April 22, 2026 19:40
marythought added a commit that referenced this pull request Apr 24, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants