Description
What is your use-case and why do you need this feature?
When we write custom serializer for class, which contains plugin generated serializer inside, we cannot use with
parameter of @Serializable
because on this case, plugin serializer will not be generated.
In this case we have to manually use custom serializer in all case when we want to use our class serialization, because we cannot use @Serializable(with = MySerializer)
instead.
In my case I'm trying to deserialize enum with generated serializer and if I get exception I catch it and return default value. It also can be used for some data transformations during decoding or encoding.
Describe the solution you'd like
It would be nice to have ability to generate and use plugin serializer when use class annotation @Serializable(with = MySerializer)
. For example, we can add extra parameter generateSerializer
for @Serializable
or use one more annotation to let plugin know, that we still need serializer. Generated serializer can have another name, for example generatedSerializer()
.