Ben Woodworth
02/15/2020, 8:05 PMjava.lang.UnsupportedOperationException: The only generic classes supported for now are standard collections, got class class ResponseEnvelope
It looks like the solution to this was to use KotlinxSerializer.setMapper(...)
in the HttpClientConfig
, but that's been deprecated.
Here is the erroring line of code:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/src/main/kotlin/net/benwoodworth/groupme/GroupMe.kt#L75
Here is ResponseEnvelope, the class I want to deserialize:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/src/main/kotlin/net/benwoodworth/groupme/ResponseEnvelope.kt
Here is the ktor HttpClient declaration:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/src/main/kotlin/net/benwoodworth/groupme/GroupMe.kt#L53-L61
And here is my build.gradle:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/build.gradle
Any idea how I might be able to fix this?Dominaezzz
02/15/2020, 8:32 PMsetMapper
wouldn't help here anyway. You'll have to pass in the serializer at call site. I'll find you an example.val responseStr = client.get<String> {
url("$API_V3/users/me")
}
val response = Json.parse(ResponseEnvelope.serializer(JsonObjectSerializer), responseStr)