Skip to content

fix: register EmbeddedObjectConverter in ContentstackClient constructor#182

Draft
OMpawar-21 wants to merge 1 commit into
developmentfrom
fix/DX-9288
Draft

fix: register EmbeddedObjectConverter in ContentstackClient constructor#182
OMpawar-21 wants to merge 1 commit into
developmentfrom
fix/DX-9288

Conversation

@OMpawar-21

Copy link
Copy Markdown
Contributor

Summary

  • Register EmbeddedObjectConverter in ContentstackClient constructor so .includeEmbeddedItems().Fetch<T>() deserializes _embedded_items without crashing when the model implements IEntryEmbedable
  • Bump contentstack.utils dependency to 1.4.0 which ships the concrete EmbeddedObject class and EmbeddedObjectConverter
  • Version bump to 2.28.0

Problem

Customers calling .includeEmbeddedItems().Fetch<T>() on a model implementing IEntryEmbedable received a JsonSerializationException at runtime whenever the Delivery API returned _embedded_items in the response:

Could not create an instance of type Contentstack.Utils.Interfaces.IEmbeddedObject.
Type is an interface or abstract class and cannot be instantiated.
Path 'entry._embedded_items.rte_json[0]._content_type_uid'

IEntryEmbedable.embeddedItems is typed as Dictionary<string, List<IEmbeddedObject>>. With no JsonConverter registered, Newtonsoft.Json tried to new() the interface directly and threw.

Changes

ContentstackClient.cs

One line added in the constructor after the existing CSJsonConverterAttribute loop:

// Handles deserialization of embedded entries and assets in _embedded_items responses.
SerializerSettings.Converters.Add(new EmbeddedObjectConverter());

Auto-register EmbeddedObjectConverter on SerializerSettings so that
_embedded_items deserialization works out of the box when the model
implements IEntryEmbedable. Bump utils dependency to 1.4.0.

Fixes JsonSerializationException thrown by .includeEmbeddedItems().Fetch<T>()
when the Delivery API response contains embedded entries or assets.
@OMpawar-21 OMpawar-21 requested review from cs-raj and reeshika-h June 24, 2026 06:30
@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.

1 participant