-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable implicit conversion from kotlin.time.Duration to java.time.Duration #683
Comments
First, Personally, I agree that the default behavior should be to match the behavior to A better way of implementation would be to use |
Hi @k163377, thanks for the tip with That being said, if this works with annotations then (I think) it is doable. Unfortunately at the moment I lack knowledge of Jackson internals to push it further. If I will have some spare time I will try to dig deeper. Any further tips/ideas are warmly welcome. |
@kkurczewski |
Resolved by merge #689. |
Use case
Usage of
kotlin.time.Duration
instead ofjava.time.Duration
in Kotlin projectsDescribe the solution you'd like
My proposal is to add additional serialization option like:
KotlinSerializationFeature.SERIALIZE_KOTLIN_DURATION_AS_JAVA_DURATION
.It would call
kotlin.time.Duration.toJavaDuration()
under hood and allow to reuse all features already implemented forjava.time.Duration
. It could be disabled by default to keep backward compatibility.Describe alternatives you've considered
I can implement custom de/serializers or write custom
KotlinTimeModule
etc. While it is not a big deal downside of this is that implementation would be very similar (identical?) for everyone and has to be copy-pasted over all projects therefore I think it is a good fit for library.The text was updated successfully, but these errors were encountered: