OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Kotlin] client generator support for coroutines and suspend functions

Open
#5,076 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Retrofit Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

I am trying to generate a kotlin client using retrofit 2.6.* and make use of coroutines and suspend functions but that is not given as an option in the generator

Describe the solution you'd like

Addition of a parameter in the generator that will generate a kotlin client with coroutines and suspend functions.

Describe alternatives you've considered

The addition of coroutines and suspend functions would big a big help in creating cleaner code in the applications using the generated client

Additional context

I have seen that there was a request to merge a new kotlin generator
https://github.com/OpenAPITools/openapi-generator/issues/3135
that contained support for coroutines but instead it was decided to go with the current kotlin generator and add retrofit2 as supported library. However, those changes did not include the possibility of generating suspend functions.

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 by reviewing the current Kotlin client generator and the prior coroutine-related request in issue 3135, then locate how the Retrofit 2 library option is handled. The work is complete when a generator parameter enables Kotlin coroutine and suspend-function output for Retrofit 2 clients, with coverage for the generated behavior.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.