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

Section on object is handled as array #9

Closed
milung opened this issue Aug 9, 2019 · 2 comments
Closed

Section on object is handled as array #9

milung opened this issue Aug 9, 2019 · 2 comments
Labels
Milestone

Comments

@milung
Copy link

milung commented Aug 9, 2019

See PR #8.

If the section with object but not array is used, it is incorrectly interpreted as section with array. The reason is that section renderer cannot recognize it as IDictionary, but while JObject implements both IDictionary<string, JToken> and IEnumerable. Proposed fix is by converting this special case into Dictionary of properties.

@Romanx Romanx added this to the v1.2 milestone Aug 11, 2019
@Romanx
Copy link
Contributor

Romanx commented Aug 11, 2019

Hi there,

Thanks very much for opening this issue. You're right it seems to be related to how we identity that the section can be iterated on and it instead tries to loop through all the members in the JObject. We have a method of filtering types we don't want the standard logic to apply which we do for both string and IDictionary.

You can override the section blacklist by using the SetSectionBlacklistTypes method on the builder however this doesn't allow you to just add to the blacklist which we've added to Stubble here: StubbleOrg/Stubble#70

With this change we can add to the extension the ability to blacklist IDictionary<string, JToken> which will make the logic work as intended

@Romanx
Copy link
Contributor

Romanx commented Aug 11, 2019

@milung Thanks to your report and contribution of a fix for this. The updated code has been released on nuget in version v1.2.3

Please feel free to open another issue you if you have any other problems. Thank you for using Stubble! 👍

@Romanx Romanx closed this as completed Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants