-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feature Request - support custom jackson object mapper #29
Comments
Hi @liorhar could you share bit more details on where do you use this and in which scenario? Are you referring to template model, when sending emails with templates? Thanks |
Hi @ibalosh @Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class PeriodData {
public LocalDate start;
public LocalDate end;
} List<PeriodData> periods = this.periodService.getPeriods(contract);
HashMap<String, Object> model = new HashMap<>() {{
put("periods", periods);
//
}};
TemplatedMessage message = new TemplatedMessage(senderAddress, recipient);
message.setMessageStream("outbound");
message.setTemplateId(templateId);
message.setTemplateModel(model);
postmarkClient.deliverMessageWithTemplate(message); However, I encounter the following error:
The ObjectMapper defined here does not seem to have the Java Time module configured. Is there a fix please? Update: message.setTemplateModel(mapper.writeValueAsString(model)); |
Hi @valh1996 Sorry for the late response. At the moment, we suggest transforming the model for specific objects, just the way you did in the workaround. If you would like to file a feature request that we could add in future, please create a separate feature request. |
It would be useful if the object mapper used to serialize the template parameters was customizable.
For example, the built-in object mapper uses
PropertyNamingStrategy.UPPER_CAMEL_CASE
while we preferLOWER_CAMEL_CASE
Also, we're using Kotlin so registering the kotlin module would be very useful
The text was updated successfully, but these errors were encountered: