OpenFeign / OpenFeign/feign

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

Open
#2,019 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted kotlin needs info
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

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 {
           ...
        }
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the suspending method in TestClient and trace how its return type reaches CustomDecoder.decode, using the reported Feign Kotlin 12.3 and Kotlin 1.8.10 setup. Confirm why the type is reported as java.lang.Object instead of TestObject and ensure the decoder receives the proper type for suspending methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.