-
Notifications
You must be signed in to change notification settings - Fork 53
Add UUID to kotlinx.serialization #362
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
Comments
Hi @alex-rieger, Since kotlinx.serialization does not have a built in serializer for UUID it was decided to ignore the
It is possible to provide a custom serializer for these types using the We could probably add an option to make fabrikt generate add Would that solve your use case? |
thanks for the detailed insights I was not aware of I'd also be happy to tackle this issue if you decide that it has a place in the library :) |
You're welcome 🙂 I think it would be a nice addition to the library. It would be great to have you contribute, but I already started working on a solution last week motivated by need for a custom serializer for BigDecimal (#364). I have just opened a PR with the proposed changes here: #368. Perhaps you could you take a look? |
I messed around a bit with the version in #368 and regenerated my models & controllers with it. Thank you! |
Great to hear, Alex! #368 is merged and I am confident that a new release will be out soon! 👀 |
Thanks for implementing! I'm looking forward to checking out the new release 💯 |
Hello,
When using kotlinx.serialization strings with
format: uuid
are converted toString
in models, while Jackson serialization generatesUUID
. I think it would be a good addition if kotlinx.serialization is also able to produceUUID
. Directly havingUUID
would eliminate the need to convertUUID <> String
when working with e.g. Exposed.Is this something that could be done? I'd be happy to open a pull request for it.
I found the following code in
kotlin/com/cjbooms/fabrikt/model/KotlinTypeInfo.kt
:As far as I'm aware Kotlin's Uuid is not stable yet. Maybe this feature could be added as Type Override so users can choose whether it will be UUID / String (Uuid in future)?
Examples
The text was updated successfully, but these errors were encountered: