Skip to content

Commit

Permalink
fix(core): serialize duration as strings in Property
Browse files Browse the repository at this point in the history
Fixes #5615
  • Loading branch information
loicmathieu committed Nov 25, 2024
1 parent 508251e commit 5263872
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/src/main/java/io/kestra/core/models/property/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
Expand Down Expand Up @@ -36,7 +33,12 @@
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PACKAGE)
public class Property<T> {
private static final ObjectMapper MAPPER = JacksonMapper.ofJson();
// By default, durations are stored as numbers.
// We cannot change that globally, as in JDBC/Elastic 'execution.state.duration' must be a number to be able to aggregate them.
// So we only change it here.
private static final ObjectMapper MAPPER = JacksonMapper.ofJson()
.copy()
.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false);

private String expression;
private T value;
Expand Down

0 comments on commit 5263872

Please sign in to comment.