Skip to content

feat: entry variants branch support#240

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

feat: entry variants branch support#240
reeshika-h wants to merge 3 commits into
developmentfrom
feat/DX-7266-variant-branch-support

Conversation

@reeshika-h

Copy link
Copy Markdown
Contributor
  • implementation

@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

@reeshika-h reeshika-h requested a review from sunil-lakshman May 14, 2026 05:45

@sunil-lakshman sunil-lakshman 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.

Add version bump and changelog

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 Content Management API “entry variants” support to the Java SDK, including stack-branch header propagation/overrides and publish/unpublish flows that require an api_version header, plus request-shape unit tests and fixtures.

Changes:

  • Added entry-variant endpoints to EntryService and corresponding public APIs on Entry (fetch/create/update/delete + publish/unpublish variants + branch handling helpers).
  • Introduced new unit tests and JSON fixtures to validate request paths, query params, and headers (including branch and api_version).
  • Extended shared constants/error messages to support variant-specific headers and validation.

Reviewed changes

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

Show a summary per file
File Description
src/main/java/com/contentstack/cms/stack/EntryService.java Adds Retrofit endpoints for entry-variant CRUD and adds query support to publish/unpublish.
src/main/java/com/contentstack/cms/stack/Entry.java Adds branch/variant UID helpers and entry-variant operations, plus variant publish/unpublish helpers.
src/main/java/com/contentstack/cms/core/Util.java Adds header constants for variant personalization and entry-variant publish API versioning.
src/main/java/com/contentstack/cms/core/ErrorMessages.java Adds a validation message for missing Variant UID.
src/main/java/com/contentstack/cms/Contentstack.java Updates stack(branch) Javadoc to clarify branch header behavior and overriding.
src/test/java/com/contentstack/cms/stack/EntryVariantUnitTest.java New request-shape unit tests covering entry-variant endpoints and branch precedence.
src/test/java/com/contentstack/cms/stack/EntryVariantAPITest.java New request-shape API test suite for entry-variant operations using fixtures and branch defaults.
src/test/java/com/contentstack/cms/stack/APISanityTestSuite.java Registers the new entry-variant API tests in the sanity suite.
src/test/java/com/contentstack/cms/UnitTestSuite.java Registers the new entry-variant unit tests in the unit suite.
src/test/java/com/contentstack/cms/TestClient.java Adds env-configurable defaults for entry-variant test content type/branch/locale.
src/test/resources/entry_variant/create_entry_variant.json Adds fixture payload for create variant requests.
src/test/resources/entry_variant/update_entry_variant.json Adds fixture payload for update variant requests.
src/test/resources/entry_variant/publish_entry_variant.json Adds fixture payload for publishing variants (requires api_version header).
src/test/resources/entry_variant/unpublish_entry_variant.json Adds fixture payload for unpublishing variants (requires api_version header).
pom.xml Changes surefire skipTests configuration.

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

Comment thread pom.xml
Comment on lines 256 to 258
<!-- Skip during default lifecycle (e.g. publish); run tests locally with: mvn test -DskipTests=false -->
<!-- <skipTests>true</skipTests> -->
<skipTests>true</skipTests>
<testFailureIgnore>true</testFailureIgnore>
Comment on lines +85 to +90
if (branchUid == null || branchUid.isEmpty()) {
return this.headers;
}
HashMap<String, Object> copy = new HashMap<>(this.headers);
copy.put(Util.BRANCH, branchUid);
return copy;
Comment on lines +73 to +78
private void validateVariantUid(@NotNull String variantUid) {
Objects.requireNonNull(variantUid, ErrorMessages.VARIANT_UID_REQUIRED);
if (variantUid.isEmpty()) {
throw new IllegalArgumentException(ErrorMessages.VARIANT_UID_REQUIRED);
}
}
Comment on lines +101 to +104
public Entry addBranch(@NotNull String branchUid) {
this.headers.put(Util.BRANCH, branchUid);
return this;
}
Comment on lines +29 to +32
/** Content type UID for entry-variant tests (default {@code blog}). */
public static final String ENTRY_VARIANT_CONTENT_TYPE_UID =
env.get("entryVariantContentTypeUid") != null ? env.get("entryVariantContentTypeUid") : "blog";

Comment on lines +33 to +36
/** Stack branch for entry-variant tests (default {@code develop}). */
public static final String ENTRY_VARIANT_BRANCH =
env.get("entryVariantBranch") != null ? env.get("entryVariantBranch") : "develop";

Comment on lines +37 to +40
/** Locale query param for entry-variant tests (default {@code en-us}). */
public static final String ENTRY_VARIANT_LOCALE =
env.get("entryVariantLocale") != null ? env.get("entryVariantLocale") : "en-us";

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.

3 participants