Skip to content

Add variant and branch support in Entry and Query APIs#295

Draft
reeshika-h wants to merge 4 commits into
developmentfrom
feat/DX-7325-variant-branch-support
Draft

Add variant and branch support in Entry and Query APIs#295
reeshika-h wants to merge 4 commits into
developmentfrom
feat/DX-7325-variant-branch-support

Conversation

@reeshika-h

Copy link
Copy Markdown
Contributor

Introduce support for variants and branches in the Entry and Query APIs, along with integration tests to validate the new functionality. This enhancement allows users to specify variant UIDs and branch names when making requests.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

Copy link
Copy Markdown

Coverage Summary

  • 📘 Instruction Coverage: 93%
  • 🌿 Branch Coverage: 80%

@sunil-lakshman sunil-lakshman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds variant and branch support to the Java Delivery SDK’s Entry and Query request builders by introducing new variants(...) overloads that populate request headers, plus new unit/integration tests to validate the behavior.

Changes:

  • Add variants(String) / variants(String[]) and branch-scoped variants(..., branch) overloads on Entry and Query to set x-cs-variant-uid and branch headers.
  • Add branch-availability detection to test credentials and introduce new integration test suites covering header behavior and real API calls.
  • Expand existing unit tests for Entry/Query to cover the new variants+branch APIs.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/main/java/com/contentstack/sdk/Entry.java Adds variants + branch overloads that set request headers for entry fetches.
src/main/java/com/contentstack/sdk/Query.java Adds variants + branch overloads that set request headers for query finds.
src/test/java/com/contentstack/sdk/Credentials.java Adds hasBranchSupport() helper used to conditionally skip branch tests.
src/test/java/com/contentstack/sdk/TestEntry.java Adds unit tests for variants-with-branch behavior on Entry.
src/test/java/com/contentstack/sdk/TestQuery.java Adds unit tests for variants-with-branch behavior on Query.
src/test/java/com/contentstack/sdk/VariantBranchIT.java Adds integration tests focused on header correctness and edge cases (some offline).
src/test/java/com/contentstack/sdk/VariantBranchApiIT.java Adds API integration tests validating variant+branch behavior against a real stack.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/contentstack/sdk/Entry.java
Comment thread src/main/java/com/contentstack/sdk/Entry.java
Comment thread src/main/java/com/contentstack/sdk/Entry.java
Comment thread src/main/java/com/contentstack/sdk/Query.java
Comment thread src/main/java/com/contentstack/sdk/Query.java
Comment thread src/main/java/com/contentstack/sdk/Query.java Outdated
…anch headers

Addresses Copilot review on PR #295:
- Guard variants(String) and variants(String[]) against null input
- Treat whitespace-only variant/branch as blank via trim().isEmpty()
- Join multi-variant header with "," for consistency with other SDK headers

Blank input intentionally skips (does not remove) the header: headers are a
shared Stack-level map, so remove() would clear the header for sibling
Entry/Query objects and the Stack-level default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

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.

4 participants