Skip to content

feat(5410): variant alias helpers (GetVariantAliases, GetDataCsvariantsAttribute)#44

Merged
OMpawar-21 merged 3 commits intodevelopmentfrom
enhc/DX-5410
Mar 24, 2026
Merged

feat(5410): variant alias helpers (GetVariantAliases, GetDataCsvariantsAttribute)#44
OMpawar-21 merged 3 commits intodevelopmentfrom
enhc/DX-5410

Conversation

@OMpawar-21
Copy link
Copy Markdown

Summary

Adds utilities on Contentstack.Utils.Utils to read variant alias strings from CDA-style entry JSON (publish_details.variants) and optionally expose them as a compact JSON string under data-csvariants for HTML attributes. Supports a single entry or a batch of entries. No HTTP calls—callers pass JObject / JArray from an existing CDA response.

What changed

  • GetVariantAliases: returns entry_uid, contenttype_uid, and variants (string array) using snake_case keys when serialized.
  • GetDataCsvariantsAttribute: returns an object with data-csvariants set to a JSON string of the result array (or "[]" when the entry list is null / empty, per overload rules).
  • Invalid arguments throw ArgumentException (e.g. null entry, missing/null uid, null/empty contentTypeUid where required). Behaviour is aligned with the Java Utils SDK.

Tests

  • xUnit coverage in VariantAliasesTest using JSON fixtures (variantsSingleEntry.json, variantsEntries.json).
  • Additional negative and edge-case tests (missing uid, bad contentTypeUid, empty/missing publish_details / variants, skipped empty aliases).

Add GetVariantAliases and GetDataCsvariantsAttribute to Utils (JObject/JArray),
Include JSON fixtures, xUnit coverage.
@OMpawar-21 OMpawar-21 requested a review from a team as a code owner March 24, 2026 11:05
@OMpawar-21 OMpawar-21 requested review from cs-raj and reeshika-h and removed request for a team March 24, 2026 11:05
Copy link
Copy Markdown
Contributor

@reeshika-h reeshika-h left a comment

Choose a reason for hiding this comment

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

lgtm

@OMpawar-21 OMpawar-21 merged commit 7f8911b into development Mar 24, 2026
9 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.

3 participants