https://kotlinlang.org logo
#http4k
Title
# http4k
r

Razvan

02/03/2021, 6:42 PM
Any idea how to make kapt (http4k-connect) generate the right return type ? I changed form
Result<R. RemoteFailure>
to
Result<R, Response>
but it keeps generating the extension action function with RemoteFailure. Cleaned hole project but still fails with:
Copy code
Type mismatch: inferred type is Result<LineAidResponse /* = Map<String, String> */, Response> but Result<Map<String, String>, RemoteFailure> was expected
d

dave

02/03/2021, 6:46 PM
ah - at the moment it's hardcoded to RemoteFailure. We'll have to fix that
for the moment, take a copy of the
Http4kConnectAdapterProcessor
and fix it up manually?
r

Razvan

02/03/2021, 6:49 PM
The problem I had with RemoteFailure is that it requires the app that uses the connecter to add connect-core as dependency if it wants to pass the response to another function.... Wouldn't be useful RemoteFailure in http4k-core ?
d

dave

02/03/2021, 6:50 PM
can the other app see the Action interface?
they're in the same place.
basically there might also be a problem with the dependencies (which we can fix)..
r

Razvan

02/03/2021, 6:56 PM
No the app does not have dependency to the connect-core where Action is. Just to the specific connector I made. I can access the response's members via response.reason but just can't pass it to other function (I can workaround by creating another object that uses the response.reason members).
d

dave

02/03/2021, 7:16 PM
I've fixed the
Http4kConnectAdapterProcessor
so it doesn't hardcode the result and you are free to vary the result type as you wish.
@Razvan v2.14.1.0 is releasing right now with that change so hopefully that will unblock you.
r

Razvan

02/03/2021, 7:20 PM
Thanks that's fast. Wasn't true the fact that I can access RemoteFailure members without... I can from ide but does not build as depency is missing. Thanks a lot
Another question about connect can't the kapt plugin n use the version from the bom ?
Copy code
kapt("org.http4k:http4k-connect-kapt-generator:2.14.1.0")
if I don't set the version it fails with
> Could not find org.http4khttp4k connect kapt generator.
d

dave

02/03/2021, 8:20 PM
I don't know why it doesn't work with teh kapt method...
the release is finally running... after a bunch of hassle.
should be available in a few minutes in jcenter
r

Razvan

02/03/2021, 9:33 PM
Thank you ! Works as expected.
d

dave

02/04/2021, 12:47 PM
👍