https://kotlinlang.org logo
z

zt

06/08/2023, 2:38 AM
I can't tell if I'm doing something wrong or I've found a bug I have the following code:
Copy code
internal typealias ApiContinuation<T> = @Serializable(ContinuationSerializer::class) List<T>

internal class ContinuationSerializer<T : Any>(tSerializer: KSerializer<T>) : JsonTransformingSerializer<List<T>>(ListSerializer(tSerializer)) {
    override fun transformDeserialize(element: JsonElement) = element
        .jsonObject["onResponseReceivedActions"]!!
        .jsonArray.single()
        .jsonObject["appendContinuationItemsAction"]!!
        .jsonObject["continuationItems"]!!
}

internal typealias RecommendedContinuation = ApiContinuation<Renderer>
Then I just pass the ReccomendedContinuation to the body method in ktor
io.ktor.serialization.JsonConvertException: Illegal input: Expected start of the array '[', but had 'EOF' instead at path: $
I added a basic print statement to the transformDeserialize method, and it's not even getting called. It's not even using my serializer for some reason
3 Views