https://linen.dev logo
#help
Title
# help
m

Michael Sela

11/09/2023, 12:39 PM
Hi All, I am trying to upgrade wiremock from 2.29.0 to 3.0.1. in 2.29 I successfully managed to use handlebar helpers to perform response templating that looks like this:
Copy code
{
  "loanAppId": {{jsonPath request.body '$.loanAppId'}},
"applicantScores": [
{{#with (jsonPath request.body '$.applicants') }}
{{#each this as | applicant |}}
{
"externalId": "{{applicant.externalId}}",
"id": "{{applicant.id}}",
"score": 0.01,
"declineReasons": [{
"reasonLabel": "ir5",
"reasonDescription": "Desc",
"declineRuleLabel": "label",
"priorityOrder": 1
}]
}
{{#unless @last}},{{/unless}}
{{/each}}
{{/with}}
]
}
However, in the new version , the calling service to my wiremock server now throws an error that looks like this: `Cannot deserialize value of type
java.lang.Long
from Object value (token
JsonToken.START_OBJECT
)\n at [Source: (BufferedReader); line: 2, column: 16] (through reference chain: [\"loanAppId\"]) com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)\n\tat com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1741)\n\tat com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToke` . One thing I noticed changing in the new version is the is that registering the
ResponseTemplateTransformer
in the extensions now requires new arguments
public ResponseTemplateTransformer(TemplateEngine templateEngine, boolean global, FileSource files, List<TemplateModelDataProviderExtension> templateModelDataProviders) {
. In version 2.29 that constructor only required 2. Is there anything at all you can think of between these versions that would have changed in terms of the response templating that may have caused this? In addition, maybe I am doing something wrong with registering this extension as I do not really know what the new constrcutor arguments should look like now. Thank you for any advice on this.
l

Lee Turner

11/09/2023, 2:07 PM
Hi, quick question, is there a reason you are moving to version
3.0.1
? We have just released version
3.3.1
recently so was wondering if it would be worth using that version first?
Would you also be able to provide your mapping file and an example payload so we can take a look at what might be going wrong.
67 Views