Skip to content
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

Add support for Kotlin serialization #47

Open
raderio opened this issue Apr 14, 2019 · 6 comments
Open

Add support for Kotlin serialization #47

raderio opened this issue Apr 14, 2019 · 6 comments
Labels
type: enhancement New feature or request

Comments

@raderio
Copy link

raderio commented Apr 14, 2019

https://github.com/Kotlin/kotlinx.serialization

Kotlin cross-platform / multi-format reflectionless serialization.
Kotlin serialization consists of a compiler plugin, which automatically produces visitor code for classes, and runtime library, which uses generated code to serialize objects without reflection.

@willbuck
Copy link
Contributor

willbuck commented Jan 6, 2020

@raderio is there something that would prevent you from using this? I haven't looked into it that closely yet, but I'm not certain we would be able to easily accommodate this in the internals of micronaut-core, as we want to support Java and Groovy as well, so Jackson's interoperability on all the JVM languages makes the most sense to use.

Can you provide more detail as to what "supporting" kotlin serialization would look like? Nothing should prevent you from using this yourself in your application code that I'm aware of.

@graemerocher graemerocher transferred this issue from micronaut-projects/micronaut-core Jan 7, 2020
@graemerocher
Copy link
Contributor

If a module were to be built or contributed think it makes more sense here

@willbuck
Copy link
Contributor

willbuck commented Apr 2, 2020

@raderio Any follow-up on this request?

@NorbertSandor
Copy link

NorbertSandor commented Oct 5, 2020

@raderio Any follow-up on this request?

Only as info, Spring will support kotlinx.serialization as an alternative to Jackson:

I think that many Kotlin users would be happy with a similar solution in Micronaut as well ;)

@dave08
Copy link

dave08 commented Aug 20, 2023

An extra plus for this implementation would be support for kotlin's value classes which I think Jackson can't support...

@sdelamo sdelamo added the type: enhancement New feature or request label Feb 28, 2024
@fzoli
Copy link

fzoli commented Aug 17, 2024

An extra plus for this implementation would be support for kotlin's value classes which I think Jackson can't support...

Oh yes! This is my primary reason for preferring kotlinx serialization over any other library. Moreover, it is a bit faster thanks to build-time source code generation (which is also preferred by Micronaut).

I really hate when there are two UUIDs in a function argument, and someone calls it with the wrong order, and it still compiles. A UserId is not an AccountId. Yes, both are represented by UUIDs, but who cares?

I have just started learning Micronaut. I plan to migrate from Spring Boot and use the native runtime. (In theory, Spring supports native builds too, but at the end of the day, it just doesn't work... There's always some forgotten reflection somewhere... So, I have to run tests on the JVM, collect reflection/proxy data, recompile it with the collected info, and then test it again... lol. No way. Who has time to wait for that?)

In Spring Boot, there is a springdoc library that generates the OpenAPI YAML, but it only supports FasterXML Jackson. Yes, I can switch to kotlinx serialization, but then the generated OpenAPI will be inconsistent. This is an open issue in springdoc. I think it could be problematic here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
Development

No branches or pull requests

7 participants