Move TemplateEngine into FreeMarker implementation #230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The TemplateEngine code in smithy-codegen-core was created with the
intention of making a standard interface for integrating Smithy with
different template engines. However, over time we've moved away from
template engines and more towards using SymbolProviders and custom
CodeWriter implementations.
This commit moves the TemplateEngine code into the FreeMarkerEngine directly,
and depreacates the DefaultDataTemplateEngine. Future template integrations
with Smithy should expose their own APIs, and really should only be
used/created for cases where the CodeWriter can't be used.
The biggest motivation for moving away from template engines and towards
CodeWriter is that templates for code generation often require a great
deal of logic, making templates a poor substitute for programming
languages, and template engines usually require a data model. However,
Smithy provides a great deal of libraries and APIs that already function
as a more than adequate data model, making the explicit creation of a
static data model (like in the case of Mustache or FreeMarker), more of
an excercise in making the template engine happy than in functionality.
Template engines like MTL and Rocker don't suffer from this since they
generate Java code directly and allow embedded Java code, but their use
would only further justify the remove of a standard TemplateEngine
interface since they require a typed list of arguments to invoke an
actual Java method.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.