swagger-api / swagger-api/swagger-codegen-generators

[Kotlin] option to use suspend / coroutine functions

Open
#724 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

I'd like to have the option with the kotlin client for the values to be 'suspend' calls.

My suggestion is to add an option to the configuration for kotlin client generation with 'use coroutines' which will include this library https://github.com/gildor/kotlin-coroutines-okhttp

Then pre-pend suspend to all API calls and add .await() everywhere we use .newCall()

Happy to do work - have a proof of concept already - looking for feedback on if this is a sensible approach and a desirable feature

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

No specific files or tests are named. Start by reviewing the Kotlin client generation configuration and the existing API-call templates, then compare them with the reported proof of concept; done means an opt-in coroutine setting adds the dependency and generates suspend calls using await().

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.