Skip to content

chore(docs): use shorthand enum names in subject mapping docs#308

Open
marythought wants to merge 3 commits intomainfrom
chore/DSPX-2959-shorthand-enum-docs
Open

chore(docs): use shorthand enum names in subject mapping docs#308
marythought wants to merge 3 commits intomainfrom
chore/DSPX-2959-shorthand-enum-docs

Conversation

@marythought
Copy link
Copy Markdown
Contributor

@marythought marythought commented Apr 27, 2026

Summary

  • Update Go SDK code samples to use the new shorthand enum constants (policy.OperatorIn, policy.BooleanAnd, policy.RuleAnyOf) instead of verbose proto enum names
  • Update JS SDK imports to use barrel exports from @opentdf/sdk instead of deep proto paths (@opentdf/sdk/platform/policy/objects_pb.js)
  • Update JS SDK examples to use enum values (ConditionBooleanTypeEnum.AND) instead of string literals ('CONDITION_BOOLEAN_TYPE_ENUM_AND')
  • Update Java SDK inline examples in policy.mdx to use PolicyEnums shorthand constants
  • Add SdkVersion badges with NEXT placeholders — replace with actual versions once SDK releases ship

Companion PRs

SDK PR Status
Go opentdf/platform#3408 Open
Java opentdf/java-sdk#357 Open
JavaScript opentdf/web-sdk#928 Open

Note on Java code samples

The code_samples/java/ files are pulled from the java-sdk repo at build time via docusaurus-plugin-remote-content. They will update automatically once javaSdkVersion is bumped in docusaurus.config.ts after the java-sdk release containing opentdf/java-sdk#357.

Test plan

  • npm run build passes
  • Surge preview renders correctly
  • Replace NEXT version placeholders after SDK releases

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated policy and quickstart code examples for Go, Java, and JavaScript to use simplified SDK enum constants for clearer, more idiomatic samples.
    • Switched JavaScript examples to use package entry-point imports instead of generated-module paths.
    • Added SDK version markers to code samples to show explicit language/version context and improve consistency.

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

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b1022e7b-7b9f-4723-9035-914d4bb6bc4e

📥 Commits

Reviewing files that changed from the base of the PR and between 2e4a675 and 53d6526.

📒 Files selected for processing (4)
  • code_samples/policy_code/create_attribute.mdx
  • code_samples/policy_code/create_subject_condition_set.mdx
  • docs/sdks/policy.mdx
  • docs/sdks/quickstart/go.mdx
✅ Files skipped from review due to trivial changes (2)
  • docs/sdks/quickstart/go.mdx
  • code_samples/policy_code/create_attribute.mdx

📝 Walkthrough

Walkthrough

Added SdkVersion UI markers and replaced verbose generated enum identifiers/imports with concise SDK enum constants and package-level imports in Go, Java, and JavaScript documentation examples for policy-related snippets.

Changes

Cohort / File(s) Summary
Policy code samples
code_samples/policy_code/create_attribute.mdx, code_samples/policy_code/create_subject_condition_set.mdx
Inserted SdkVersion components for Go/Java/JavaScript tabs; updated Go examples to use policy.RuleAnyOf, policy.BooleanAnd, policy.OperatorIn; changed JavaScript imports to use @opentdf/sdk instead of generated protobuf paths; corresponding Java examples updated to use SDK enum constants.
SDK docs / quickstart (Go & policy docs)
docs/sdks/policy.mdx, docs/sdks/quickstart/go.mdx
Replaced generated enum identifiers and raw strings with SDK enum constants in policy examples and Go quickstart snippets (consistent use of policy.* constants and Java/JS SDK enums).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • elizabethhealy
  • jp-ayyappan

Poem

🐇 I nibbled verbose names away,
Replaced long enums with a brighter sway,
SdkVersion flags now shine in the tabs,
Shorter imports and tidier labs,
A hopping doc fix — happy display!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(docs): use shorthand enum names in subject mapping docs' accurately reflects the main changes: updating documentation code samples to use shorthand enum constants across Go, Java, and JavaScript SDKs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/DSPX-2959-shorthand-enum-docs

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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-308.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 documentation to promote the use of shorthand enum names (e.g., 'IN', 'AND', 'OR') in API examples and descriptions, replacing the more verbose canonical proto names and numeric values. These changes are reflected across the subject mapping guides, policy component documentation, and SDK references to improve readability. I have no feedback to provide as there were no review comments.

@marythought marythought force-pushed the chore/DSPX-2959-shorthand-enum-docs branch from 2cc862d to ea2c87c Compare April 27, 2026 22:15
@marythought
Copy link
Copy Markdown
Contributor Author

Updated to companion opentdf/platform#3408 (SDK shorthand enum constants). The previous middleware approach (opentdf/platform#3401) is being replaced by this simpler SDK-only approach.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Surge preview build failed — no preview was deployed. Check the workflow logs for details.

Once the build passes, the preview will be at: https://opentdf-docs-pr-308.surge.sh

Common cause: If the build failed on vendored YAML validation, run the following locally and commit the result:

npm run update-vendored-yaml
git add specs/
git commit -m "chore(deps): update vendored OpenAPI specs"

eugenioenko
eugenioenko previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Contributor

@eugenioenko eugenioenko left a comment

Choose a reason for hiding this comment

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

Reviewed WebSDK example, those changes look correct

marythought and others added 3 commits April 29, 2026 12:40
Update Go code samples to use the new policy.OperatorIn, policy.BooleanAnd,
policy.RuleAnyOf shorthand constants instead of verbose proto enum names.

Companion to opentdf/platform#3408.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… badges

- Update JS imports to use barrel exports from @opentdf/sdk instead of
  deep proto paths
- Update policy.mdx Java example to use PolicyEnums shorthand constants
- Update policy.mdx JS example to use enum values instead of strings
- Add SdkVersion badges with NEXT placeholders to code samples
  (replace with actual versions once SDK releases ship)

Note: Java code_samples/java/ files are pulled from the java-sdk repo
at build time via remote-content plugin. They will update automatically
once javaSdkVersion is bumped in docusaurus.config.ts after the
java-sdk release containing opentdf/java-sdk#357.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
- Go: 0.18.0 (opentdf/platform#3410)
- Java: 0.15.0 (opentdf/java-sdk#358)
- JS: 0.17.0 (opentdf/web-sdk#929)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@marythought marythought force-pushed the chore/DSPX-2959-shorthand-enum-docs branch from 2e4a675 to 53d6526 Compare April 29, 2026 19:46
@marythought marythought enabled auto-merge (squash) April 29, 2026 20:03
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