Although this query is 1 year old, it may still be relevant for more recent Wiremock users.
Using version 2.32, I managed to fulfill the requirement expressed above (return request body with id appended in a generic way) with the following response:
"response": {
"transformers": ["response-template"],
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "responses/get_with_id_{{jsonPath request.body '$.name'}}.json"
}
and following response file content:
{
{{#each (jsonPath request.body '$.') as |value key|}}
"{{key}}": "{{value}}",
{{/each}}
"id": "my-id"
}
The extended expression of the each handlebar is only available with Handlebars 3.0+. This was already included in Wiremock 2.29.0.