OpenFeign/feign

feign-kotlin: Decoder type returns "Object" when method is suspending

Open

#2.019 aberto em 23 de abr. de 2023

Ver no GitHub
 (6 comments) (1 reaction) (0 assignees)Java (1.911 forks)batch import
help wantedkotlinneeds info

Métricas do repositório

Stars
 (9.070 stars)
Métricas de merge de PR
 (Mesclagem média 3d 8h) (59 fundiu PRs em 30d)

Description

Currently using feign-kotlin 12.3 and kotlin 1.8.10 while attempting to use a custom decoder. When my method in the the TestClient is suspending type is printed out as "java.lang.Object" however, when not using suspend it returns the proper type of TestObject. This is currently preventing me from being able to get the proper serializer

Client Snippet:

public interface TestClient  {
    @RequestLine("GET /{uuid}")
    public suspend fun testGet(@Param("uuid") uuid: UUID): TestObject
}

Decoder snippet:

public class CustomDecoder: Decoder {
    override fun decode(response: Response, type: Type): Any? {
        if (response.status() != 404 && response.status() != 204) {
                ...
                println(type)
               ...
            }
        } else {
           ...
        }
    }
}

Guia do colaborador