This is an automated email from the ASF dual-hosted git repository.

fjtiradosarti pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git


The following commit(s) were added to refs/heads/main by this push:
     new 1f7bef99a3 [Fix #3778] Serializing dates as strings (#3779)
1f7bef99a3 is described below

commit 1f7bef99a3aa5b273608e5647829f2433212109d
Author: Francisco Javier Tirado Sarti 
<[email protected]>
AuthorDate: Mon Nov 18 15:09:17 2024 +0100

    [Fix #3778] Serializing dates as strings (#3779)
---
 .../class-templates/config/GlobalObjectMapperQuarkusTemplate.java       | 1 +
 .../class-templates/config/GlobalObjectMapperSpringTemplate.java        | 1 +
 .../src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java | 2 ++
 3 files changed, 4 insertions(+)

diff --git 
a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java
 
b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java
index c670e699f9..035438a814 100644
--- 
a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java
+++ 
b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperQuarkusTemplate.java
@@ -42,6 +42,7 @@ public class GlobalObjectMapper implements 
ObjectMapperCustomizer {
         if (!configBean.failOnEmptyBean()) {
             mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
         }
+        mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
         mapper.setDateFormat(new 
StdDateFormat().withColonInTimeZone(true).withTimeZone(TimeZone.getDefault()));
         
mapper.registerModule(JsonFormat.getCloudEventJacksonModule()).findAndRegisterModules();
     }
diff --git 
a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java
 
b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java
index 86896e5799..77d853abd9 100644
--- 
a/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java
+++ 
b/kogito-codegen-modules/kogito-codegen-core/src/main/resources/class-templates/config/GlobalObjectMapperSpringTemplate.java
@@ -47,6 +47,7 @@ public class GlobalObjectMapper {
                 if (!configBean.failOnEmptyBean()) {
                     builder.featuresToDisable 
(SerializationFeature.FAIL_ON_EMPTY_BEANS);
                 }
+                
builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
                 builder.dateFormat(new 
StdDateFormat().withColonInTimeZone(true).withTimeZone(TimeZone.getDefault()));
                 builder.modulesToInstall(new JavaTimeModule());
             }
diff --git 
a/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java
 
b/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java
index dcc12089e8..18e13872c0 100644
--- 
a/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java
+++ 
b/kogito-workitems/kogito-jackson-utils/src/main/java/org/kie/kogito/jackson/utils/ObjectMapperFactory.java
@@ -21,6 +21,7 @@ package org.kie.kogito.jackson.utils;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.MapperFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.json.JsonMapper;
 import com.fasterxml.jackson.databind.type.TypeFactory;
 
@@ -39,6 +40,7 @@ public class ObjectMapperFactory {
                 
.setTypeFactory(TypeFactory.defaultInstance().withClassLoader(Thread.currentThread().getContextClassLoader()))
                 .registerModule(JsonFormat.getCloudEventJacksonModule())
                 .registerModule(new CommonObjectModule())
+                .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
                 .findAndRegisterModules();
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to