VirtusLab / scala-yaml

https://virtuslab.github.io/scala-yaml/
Apache License 2.0
92 stars 22 forks source link

Support for more codecs (`Duration`, `java.time.LocalDate`, etc ...) #275

Open ramytanios opened 7 months ago

ramytanios commented 7 months ago

Hi

Would be cool to have codecs for objects such as scala.concurrent.Duration, java.time.LocalDate, java.time.Instant. For the Duration, I would get inspired by pureconfig: https://github.com/pureconfig/pureconfig/blob/7d15967d12b3bee0fc7bbd13325ebb787a8a3a31/core/src/main/scala/pureconfig/DurationUtils.scala

Thanks

lbialy commented 2 months ago

Problem with this is that we'd like to avoid having biased instances as these types usually do not have a canonical string representation and providing a biased one would lead to rather troublesome conflict scenarios where users need to override our instances to fit their specific encoding.

If one were to actually implement these instances they would need to go into a lower priority trait that companion object would extend.