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

Configure Serializer to allow null values - Handlebar Templates not respecting scope on each loops #202

Open
matthewlramsey opened this issue Feb 8, 2018 · 0 comments

Comments

@matthewlramsey
Copy link

We are currently using Mandrill.net to send transactional email, using Handlebar templates. When sending content for our desired template, the default serializer configured in Mandrill.net is ignoring null value fields: `NullValueHandling = NullValueHandling.Ignore,' This means that the footprint of the elements in our merge variable content list can differ, depending on the values that are non-null. EX, a list of object's with properties A, B, C and D may look like:

[
	{
		"A": "A content",
		"D": "D content"
	},
	{
		"A": "A content",
		"B": "B content"
	},
	{
		"B": "B new content",
		"C": "C content"
	}
]

We have noticed that when this is the case, the Handlebars template engine in Mandrill will "hold onto values" out of scope of the current loop variable, if they are not defined as null. In this example, the first result would render with values A and D, correctly. The second value, however, would have values A, B, and D - even though D was not part of the second element of the list, etc. Ex:

A Content, D Content
A Content, B Content, D Content
A Content, B New Content, C Content, D Content

For us, this is a big issue - we are hoping that simply passing null's into Mandrill will prevent, but are still looking into solutions at this time. Does anyone have any ideas on ways to prevent this scoping issue? Would it be possible to override the serializer used by Mandrill.net without branching and/or configuring this as an optional setting? Help is very appreciated!

Thanks,
Matt Ramsey

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

No branches or pull requests

1 participant