Migrate EPP XML generation from Soy to JAXB and emails to FreeMarker#3038
Conversation
1268bcc to
d9d1130
Compare
dcec4a2 to
9258e15
Compare
| 'com.google.template:soy:[2024-02-26,)', | ||
| 'com.google.truth:truth:[1.1.2,)', | ||
| 'com.googlecode.json-simple:json-simple:[1.1.1,)', | ||
| 'org.freemarker:freemarker:2.3.32', |
There was a problem hiding this comment.
Don't lock this to this specific revision. Use the open-ended [ ) syntax.
| and is written primarily in Java. It is the software that | ||
| [Google Registry](https://www.registry.google/) uses to operate TLDs such as .google, | ||
| .app, .how, .soy, and .みんな. It can run any number of TLDs in a single shared registry | ||
| .app, .how, and .みんな. It can run any number of TLDs in a single shared registry |
5f0a007 to
0b20767
Compare
a4a0fc1 to
cd82ada
Compare
weiminyu
left a comment
There was a problem hiding this comment.
@weiminyu reviewed 58 files and made 1 comment.
Reviewable status: 58 of 104 files reviewed, 10 unresolved discussions (waiting on CydeWeys).
common/src/main/java/google/registry/util/TemplateRenderer.java line 57 at r5 (raw file):
* @throws RuntimeException if the template cannot be found, parsed, or processed */ public String render(String templatePath, ImmutableMap<String, Object> dataModel) {
If template variables and dataModel map keys do not match, missing or unused data keys, will the render throw an error?
CydeWeys
left a comment
There was a problem hiding this comment.
@CydeWeys made 2 comments and resolved 2 discussions.
Reviewable status: 58 of 104 files reviewed, 8 unresolved discussions (waiting on weiminyu).
| 'com.google.template:soy:[2024-02-26,)', | ||
| 'com.google.truth:truth:[1.1.2,)', | ||
| 'com.googlecode.json-simple:json-simple:[1.1.1,)', | ||
| 'org.freemarker:freemarker:2.3.32', |
| and is written primarily in Java. It is the software that | ||
| [Google Registry](https://www.registry.google/) uses to operate TLDs such as .google, | ||
| .app, .how, .soy, and .みんな. It can run any number of TLDs in a single shared registry | ||
| .app, .how, and .みんな. It can run any number of TLDs in a single shared registry |
|
Yes, FreeMarker strictly throws an exception for missing variables. Unused variables in the data model are safely ignored. I have added explicit tests for both of these behaviors in |
There was a problem hiding this comment.
⚠️ Attention Required: Lockfile Detected
This pull request contains modifications to one or more *.lockfile files. Please confirm that you have run update_dependency.sh to push new dependencies to the private repo.
Someone with Admin role must manually dismiss this review before merging.
| @XmlRootElement | ||
| public static class Create extends HostCreateOrChange | ||
| implements ResourceCreateOrChange<Host.Builder> { | ||
| public static class Create extends HostCreateOrChange { |
CydeWeys
left a comment
There was a problem hiding this comment.
@CydeWeys made 1 comment.
Reviewable status: 19 of 114 files reviewed, 11 unresolved discussions (waiting on weiminyu).
common/src/main/java/google/registry/util/TemplateRenderer.java line 57 at r5 (raw file):
Previously, weiminyu (Weimin Yu) wrote…
If template variables and dataModel map keys do not match, missing or unused data keys, will the render throw an error?
Yes, and added a test.
There was a problem hiding this comment.
⚠️ Attention Required: Lockfile Detected
This pull request contains modifications to one or more *.lockfile files. Please confirm that you have run update_dependency.sh to push new dependencies to the private repo.
Someone with Admin role must manually dismiss this review before merging.
|
PTAL |
- Replace deprecated Soy templates for EPP XML with JAXB models and a refined Fluent DSL. - Migrate Spec11 and administrative emails to FreeMarker with HTML auto-escaping. - Remove Soy compiler, Gradle tasks, and library dependencies. - Address PR feedback regarding shadowing, version locking, and security warnings. - Enhance tests with comprehensive XML equality assertions using Java 15 text blocks. - Improve Javadocs and maintain strict temporal consistency using java.time. FreeMarker replaces Soy for email templating, providing native HTML auto-escaping and allowing the removal of the complex 'soyToJava' compilation step from the build process. This significantly simplifies the build system and reduces maintenance overhead. For EPP XML, migrating to JAXB allows tool-generated commands to use the same model classes as the server-side EPP flows. This ensures that tool-generated XML is always schema-compliant and eliminates the risk of divergence between tool templates and actual server-side implementation. This unified approach provides compile-time type safety and improves developer ergonomics via a refined fluent DSL. The base ImmutableObject class now provides a public clone() override that correctly resets the cached hashCode to null. This centralizes the custom cloning logic previously handled by a static helper and ensures that all subclasses—including the newly added JAXB models—satisfy CodeQL security requirements without needing redundant per-class overrides. The legacy static clone(T) helper has been updated to delegate to this instance method to maintain compatibility and architectural consistency.
There was a problem hiding this comment.
⚠️ Attention Required: Lockfile Detected
This pull request contains modifications to one or more *.lockfile files. Please confirm that you have run update_dependency.sh to push new dependencies to the private repo.
Someone with Admin role must manually dismiss this review before merging.
weiminyu
left a comment
There was a problem hiding this comment.
@weiminyu reviewed 100 files and all commit messages, and resolved 1 discussion.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on CydeWeys).
weiminyu
left a comment
There was a problem hiding this comment.
@weiminyu made 1 comment.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on CydeWeys).
Update_dependency ran out of band.
This CL eliminates the deprecated Closure Template (Soy) engine from the Nomulus codebase.
Key changes:
Verified with ./gradlew :core:test and specialized tool command tests.
This change is