OpenAPITools / OpenAPITools/openapi-generator
[REQ] [Kotlin][Client] Option to remove Response<> wrapper in operation return types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Currently if you use Coroutines (suspend modifier), your generated API functions will look like this:
@GET("users/{id}")
suspend fun user(@Path("id") id: Long): Response<User>
However there is another way to define the return type of the endpoint. You can omit the Response<> wrapper, and just return the User, like this:
@GET("users/{id}")
suspend fun user(@Path("id") id: Long): User
This is described here in the Retrofit documentation.
It would be great if OpenAPI generator offer this as well. It could be controlled by a CLI option, and it could generated the current Response<User> form by default.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Kotlin coroutine client generation path and how generated operation return types are currently formed. Compare the existing Response form with Retrofit's documented plain User form, then identify where a CLI option and its default would be represented. Done means the option produces the requested return type while preserving the current Response behavior by default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100