kestra-io / kestra

Infinitely scalable, event-driven, language-agnostic orchestration and scheduling platform to manage millions of workflows declaratively in code.
https://kestra.io
Apache License 2.0
7.64k stars 467 forks source link

Duration are serialized as seconds count instead of "PT..." notation #3742

Open brian-mulier-p opened 4 months ago

brian-mulier-p commented 4 months ago

Describe the issue

See here.

I believe we should change the serialization format to "PT..." notation (in fact the Duration.toString() value, not the ObjectMapper.writeValueAsString(...)).

Maybe we will also need to change the deserializer to read from PT...

Environment

brian-mulier-p commented 2 months ago

After digging, we need to add .configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false). However, it doesn't handle the Deserialization as now durations are serialized as PTXS format but in the end it's still a string and if we don't type strongly the deserialization it will not work (which is what we do when we deserialize to map or list for eg.) so we may need to add a custom deserializer that uses regex for it (^P(?=[^T]|T.)(?:\d*D)?(?:T(?=.)(?:\d*H)?(?:\d*M)?(?:\d*S)?)?$ should work)

brian-mulier-p commented 2 weeks ago

This must be fixed once that has been tackled