Hi, I’m trying to handle a response from a ReST AP...
# ktor
h
Hi, I’m trying to handle a response from a ReST API with Ktor Client. This API has several types of response depending if it is a success or an error. I’m trying to handle this with a Sealed class. But I fail to do it. I tried using Gson/Jackson and Json. I saw the polymorphic (https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md) documentation but I have an issue because one of the attributes of the API is ‘type’ and it’s the classDiscriminator by default and I tried to change it with JsonConfiguration but with no success. I am quite stuck. Any help doing this ? Do you a tutorial, some information ? Thanks. If it is needed I can give access to the code in github (https://github.com/herveDarritchon/icndb). Everything is in the Application.kt file (https://raw.githubusercontent.com/herveDarritchon/icndb/master/src/Application.kt)
j
I have not tried this before. But comparing those links, have you tried specifying the type names explicitly? By default it should use fully qualified class names, but maybe that still helps.