Is there a way to automatically register a Seriali...
# serialization
j
Is there a way to automatically register a Serializer that is generated with KSP? I'd rather not have to manually add each generated one to the SerializersModule. (I have a bunch of data classes that just wrap one field that should be transparent to serialization, but can't seem to find a way of making a generic serializer for it, so ended up generating them)
g
Why do you need a specific serializer for data classes? If the specific "one field" is not annotated with @Serializable, you could annotate the field with @Contextual instead and just define 1 serializer instead of generating a lot of them (hopefully making your serializer list not a problem anymore).
a
If you have
data class Foo(val x: String)
and you want it to be encoded to a string, e.g.
"..."
, then you could use a value class instead. The value will be used, instead of a class (so the class is 'transparent' to serialization.)