Skip to content

Ability to optionally provide serialization for my library types #3051

@rnett

Description

@rnett

What is your use-case and why do you need this feature?

I have a library that provides a bunch of data types. I don't want to include Kotlinx serialization by default because it's rather heavy compared to the rest of my library.

However, I'd still like to be able to define serializers for my types in a separate project/module, ideally in a way where they would be used by default.

This is exactly the problem that kotlinx.collections.immutable has with their types. The closest workaround I'm aware of would be to have the serializers project define a SerializersModule consumers could use. Which is not great.

Describe the solution you'd like

I don't have a solution in mind. It's a very similar problem to #507 and #1931, and a solution for the first would likely solve the issue. But this is a distinct enough use-case (especially since I control both the data type library and the serializers library) it seemed prudent to make a dedicated issue for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions