Skip to content

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

Merged
reeshika-h merged 4 commits into
developmentfrom
feat/DX-7325-variant-branch-support
Jul 17, 2026
Merged

Add variant and branch support in Entry and Query APIs#295
reeshika-h merged 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 TypeCount (with fixes)Without fixesThresholdResult
🔴 Critical Severity0010✅ Passed
🟠 High Severity0025✅ Passed
🟡 Medium Severity00500✅ Passed
🔵 Low Severity001000✅ Passed

⏱️ SLA Breach Summary

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

SeverityBreaches (with fixes)Breaches (no fixes)SLA Threshold (with/no fixes)Status
🔴 Critical0015 / 30 days✅ Passed
🟠 High0030 / 120 days✅ Passed
🟡 Medium0090 / 365 days✅ Passed
🔵 Low00180 / 365 days✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

Copy link
Copy Markdown

Coverage Summary

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

@sunil-lakshmansunil-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

CopilotAI 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
FileDescription
src/main/java/com/contentstack/sdk/Entry.javaAdds variants + branch overloads that set request headers for entry fetches.
src/main/java/com/contentstack/sdk/Query.javaAdds variants + branch overloads that set request headers for query finds.
src/test/java/com/contentstack/sdk/Credentials.javaAdds hasBranchSupport() helper used to conditionally skip branch tests.
src/test/java/com/contentstack/sdk/TestEntry.javaAdds unit tests for variants-with-branch behavior on Entry.
src/test/java/com/contentstack/sdk/TestQuery.javaAdds unit tests for variants-with-branch behavior on Query.
src/test/java/com/contentstack/sdk/VariantBranchIT.javaAdds integration tests focused on header correctness and edge cases (some offline).
src/test/java/com/contentstack/sdk/VariantBranchApiIT.javaAdds 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 threadsrc/main/java/com/contentstack/sdk/Entry.java
Comment threadsrc/main/java/com/contentstack/sdk/Entry.java
Comment threadsrc/main/java/com/contentstack/sdk/Entry.java
Comment threadsrc/main/java/com/contentstack/sdk/Query.java
Comment threadsrc/main/java/com/contentstack/sdk/Query.java
Comment threadsrc/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 TypeCount (with fixes)Without fixesThresholdResult
🔴 Critical Severity0010✅ Passed
🟠 High Severity0025✅ Passed
🟡 Medium Severity00500✅ Passed
🔵 Low Severity001000✅ Passed

⏱️ SLA Breach Summary

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

SeverityBreaches (with fixes)Breaches (no fixes)SLA Threshold (with/no fixes)Status
🔴 Critical0015 / 30 days✅ Passed
🟠 High0030 / 120 days✅ Passed
🟡 Medium0090 / 365 days✅ Passed
🔵 Low00180 / 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 TypeCount (with fixes)Without fixesThresholdResult
🔴 Critical Severity0010✅ Passed
🟠 High Severity0025✅ Passed
🟡 Medium Severity00500✅ Passed
🔵 Low Severity001000✅ Passed

⏱️ SLA Breach Summary

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

SeverityBreaches (with fixes)Breaches (no fixes)SLA Threshold (with/no fixes)Status
🔴 Critical0015 / 30 days✅ Passed
🟠 High0030 / 120 days✅ Passed
🟡 Medium0090 / 365 days✅ Passed
🔵 Low00180 / 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 TypeCount (with fixes)Without fixesThresholdResult
🔴 Critical Severity0010✅ Passed
🟠 High Severity0025✅ Passed
🟡 Medium Severity00500✅ Passed
🔵 Low Severity001000✅ Passed

⏱️ SLA Breach Summary

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

SeverityBreaches (with fixes)Breaches (no fixes)SLA Threshold (with/no fixes)Status
🔴 Critical0015 / 30 days✅ Passed
🟠 High0030 / 120 days✅ Passed
🟡 Medium0090 / 365 days✅ Passed
🔵 Low00180 / 365 days✅ Passed

✅ BUILD PASSED - All security checks passed

@reeshika-h
reeshika-h marked this pull request as ready for review July 17, 2026 08:23
@reeshika-h
reeshika-h requested a review from a team as a code ownerJuly 17, 2026 08:23
@reeshika-h
reeshika-h merged commit dbfac4c into developmentJul 17, 2026
10 checks passed
reeshika-h added a commit that referenced this pull request Aug 7, 2026
…-support
Add variant and branch support in Entry and Query APIs
Sign up for freeto 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

@reeshika-h@sunil-lakshman@OMpawar-21