Wednesday, August 15, 2018, 10:52:41 PM, Mark Malynn wrote:

[snip]
>  3) I agree that using the well known json field 'templateName' seems
> 'hacky' (from a freemarker point of view). However, from the point of view
> of the maven plugin it works nice. It provides the flexibility I need with
> the minimum fuss. I will entertain another mechanism as long as it supports
> my main use case.
[snip]

The problem with that is that it doesn't work if you happen to need a
"tempalteName" field in your actual data. Yes, that's unlikely, but
take it as a demonstration of why it's not correct. The "correct" solution
is like this:

{
  "templateName": "foo.ftl",
  "otherFutureMavenPluginKey": "something",
  "dataModel": {
     /* your application-specific stuff */
    "myString": "a string",
    "myNumber": 1,
    ...
  }
}

Note how it allows adding new keys (like "otherFutureMavenPluginKey")
without breaking backward compatibility.

-- 
Thanks,
 Daniel Dekany

Reply via email to