Hi everybody I have a problem in external module ...
# ktor
j
Hi everybody I have a problem in external module i have "`data class XXX ....`" and with routing as i try
route("/v1/lib") {
post {
val x:XXX = call.receive()
...
and i get an exception
Caused by: kotlinx.serialization.SerializationException: Serializer for class 'XXX' is not found.
Mark the class as @Serializable or provide the serializer explicitly
do you have an idea how to deal with something like this and i can't add @Serializable before the class
a
You can write a custom serializer for that class as stated in the message.
j
you have such an example and can't it be made more pleasant
I don't know if writing your own is "nice to use"
a
I can only recommend reading the documentation about custom serializers. This issue isn't related much to Ktor so I suggest asking it in the #serialization channel.
j
I understand that there is a way of working that the class must have methods added and then the plugin but I am rewriting the api and I have around 50-80 class and write 80 serializers ..... I will use gson for now because I will be more resistant to change
in this solution, when changing the next version, I will have to write about 10 new serializers