FINERACT-2564: Migrate template package from GSON to Jackson#5722
FINERACT-2564: Migrate template package from GSON to Jackson#5722kalisingh2277 wants to merge 1 commit intoapache:developfrom
Conversation
|
Please sign your commits ,you can find more information on that in the Contributing.md file |
|
also |
8e4f2cb to
6b85caf
Compare
Replace all com.google.gson usages in org.apache.fineract.template with com.fasterxml.jackson equivalents: - Template.java: Replace GSON JsonArray/JsonElement with Jackson ObjectMapper/JsonNode for parsing mappers in fromJson() - JpaTemplateDomainService.java: Replace GSON JsonArray/JsonElement with Jackson ObjectMapper/JsonNode for parsing mappers in updateTemplate() - TemplateEntity.java: Replace GSON @SerializedName with Jackson @JsonProperty - TemplateType.java: Replace GSON @SerializedName with Jackson @JsonProperty - TemplateServiceStepDefinitions.java: Replace GSON Gson/JsonParser with Jackson ObjectMapper/TypeReference - TemplateIntegrationTest.java: Replace GSON Gson.toJson() with Jackson ObjectMapper.writeValueAsString() Signed-off-by: Kali <kalisingh2277@gmail.com>
6b85caf to
0132623
Compare
Aman-Mittal
left a comment
There was a problem hiding this comment.
How does this fit into the template module’s migration to the new command processing—are further changes expected after this, or is this considered complete for JSON handling in this package?
@vidakovic looping you in since this ties into the broader command processing work.
| mappersList.add(new TemplateMapper(element.getAsJsonObject().get("mappersorder").getAsInt(), | ||
| element.getAsJsonObject().get("mapperskey").getAsString(), | ||
| element.getAsJsonObject().get("mappersvalue").getAsString())); | ||
| try { |
There was a problem hiding this comment.
I noticed ObjectMapper is being instantiated in multiple places—should we consider reusing a shared instance (e.g., via Spring) for consistency and efficiency, or is this intentional for now?
| @@ -184,15 +184,15 @@ configurations.driver.each {File file -> | |||
| tasks.register('createDB') { | |||
| description = "Creates the MariaDB Database. Needs database name to be passed (like: -PdbName=someDBname)" | |||
| doLast { | |||
| def sql = Sql.newInstance('jdbc:mariadb://localhost:3306/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver') | |||
| def sql = Sql.newInstance('jdbc:mariadb://localhost:3306/?allowPublicKeyRetrieval=true&useSSL=false', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver') | |||
There was a problem hiding this comment.
JDBC URL change in build.gradle—should that be handled in a separate PR, since it’s not directly related to the JSON migration?
| final List<TemplateMapper> mappersList = new ArrayList<>(); | ||
| if (mappersNode != null && mappersNode.isArray()) { | ||
| for (final JsonNode element : mappersNode) { | ||
| mappersList.add(new TemplateMapper(element.get("mappersorder").asInt(), element.get("mapperskey").asText(), |
There was a problem hiding this comment.
For parsing the mappers array, would it make sense to leverage Jackson’s data binding (e.g., mapping directly to a List) instead of manual tree traversal, or is this intentional for now?
Description
This PR addresses FINERACT-2564 by migrating the
org.apache.fineract.templatepackage from legacy GSON helper classes to Jackson.Changes:
JsonArray/JsonElementusage with JacksonObjectMapper/JsonNodeinTemplate.javaandJpaTemplateDomainService.java@SerializedNamewith Jackson@JsonPropertyinTemplateEntity.javaandTemplateType.javaTemplateServiceStepDefinitions.javaandTemplateIntegrationTest.java) to use Jackson instead of GSON.All code generation and build errors have been addressed.