Lawik
04/12/2019, 1:37 PMResponse<Foo>
Response<Bar>ribesg
04/12/2019, 1:57 PMResponse, one for Foo and one for Bar. If all 3 have the @Serializable annotation it should just work.Lawik
04/12/2019, 2:05 PM@Serializable annotation.Lawik
04/12/2019, 2:07 PMprivate val client = HttpClient {
install(JsonFeature) {
serializer = KotlinxSerializer().apply {
register(Response.serializer(FooDTO.serializer()))
register(Response.serializer(PersonDTO.serializer()))
}
}
} Sadly, this causes `PersonDTO`'s serializer to apply for both PersonDTO and FooDTO.Lawik
04/12/2019, 2:08 PMResponse class @Serializable
data class Response<T>(val code: Int, val body: T?)ribesg
04/12/2019, 2:15 PMribesg
04/12/2019, 2:15 PM@Serializable on all 3 models it just works (In a JVM context)Lawik
04/12/2019, 2:18 PM"Fatal exception in coroutines machinery for CancellableContinuation(DispatchedContinuation[WindowDispatcher@1, [object Object]]){[object Response]}@2. Please read KDoc to 'handleFatalException' method and report this incident to maintainers; caused by ReceivePipelineException: Fail to run receive pipeline: NoTransformationFoundException: No transformation found: class JsHttpResponse -> class Response"ribesg
04/12/2019, 2:20 PMribesg
04/12/2019, 2:20 PMsetMapper(MyDataClass::class, MyDataClass.serializer())ribesg
04/12/2019, 2:21 PMLawik
04/12/2019, 2:21 PMribesg
04/12/2019, 2:21 PMribesg
04/12/2019, 2:22 PMFoo?Lawik
04/12/2019, 2:23 PMribesg
04/12/2019, 2:24 PMribesg
04/12/2019, 2:24 PMLawik
04/12/2019, 2:25 PMResponse class, error message(s) for instance.ribesg
04/12/2019, 2:27 PMLawik
04/12/2019, 2:28 PMribesg
04/12/2019, 2:29 PMFeature which catches non-2xx status codes and throws an exceptionribesg
04/12/2019, 2:30 PMErrorBody or something in this Featureribesg
04/12/2019, 2:31 PMLawik
04/12/2019, 3:09 PM