Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem deserializing one Kontent element into multiple properties of different types #257

Open
petrsvihlik opened this issue Jan 20, 2021 · 0 comments
Labels
bug help wanted rich-text Features and bugs related to rich-text resolution. up-for-grabs
Milestone

Comments

@petrsvihlik
Copy link
Contributor

petrsvihlik commented Jan 20, 2021

Brief bug description

Originally submitted by @Enngage: When deserializing one Kontent element into multiple properties of different types, only the first type gets resolved correctly.

Repro steps

public IRichTextContent Description { get; set; }

 [JsonProperty("description")]
public string DescriptionString { get; set; }

When these two properties are included in a single model, DescriptionString won't get resolved. If you put the JsonPropertyAttribute to the other property, the IRichTextContent won't get resolved.

Expected behavior

Both properties should get resolved correctly.

Additional context

The problem is with caching the resolved properties. The fix should be relatively simple - just extend the caching key of
the processedItems collection by adding the target property type.

Sample occurrence:
https://github.com/Kentico/kontent-delivery-sdk-net/blob/38de66829a7d1cc07bddbffc3febbf29f33788bd/Kentico.Kontent.Delivery/ContentItems/ModelProvider.cs#L169

Make sure all occurrences of processedItems in the ModelProvider are covered.

@petrsvihlik petrsvihlik added bug help wanted up-for-grabs rich-text Features and bugs related to rich-text resolution. labels Jan 20, 2021
@petrsvihlik petrsvihlik added this to the v15 milestone Jan 20, 2021
@petrsvihlik petrsvihlik modified the milestones: v15, v16 - rich-text Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted rich-text Features and bugs related to rich-text resolution. up-for-grabs
Projects
None yet
Development

No branches or pull requests

1 participant