Any idea how to make kapt (http4k-connect) generat...
# http4k
r
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
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
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
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
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
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
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
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
Thank you ! Works as expected.
d
👍