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
Aleksei Tirman [JB]
06/16/2023, 12:28 PM
You can write a custom serializer for that class as stated in the message.
j
Jacol
06/16/2023, 12:30 PM
you have such an example and can't it be made more pleasant
Jacol
06/16/2023, 12:31 PM
I don't know if writing your own is "nice to use"
a
Aleksei Tirman [JB]
06/16/2023, 12:45 PM
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
Jacol
06/16/2023, 1:10 PM
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
Jacol
06/16/2023, 1:12 PM
in this solution, when changing the next version, I will have to write about 10 new serializers