question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Kotlin Coroutines

See original GitHub issue

Kotlin coroutines add an extra Continuation parameter in the suspending function. This means that there is an additional parameter in our Controller’s methods. Currently, we are facing two issues with this.

1st Issue Depending on where the code is built, we get the following error while accessing Swagger:

com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: io.swagger.v3.oas.models.OpenAPI[“paths”]->io.swagger.v3.oas.models.Paths[“/srv/v1/{redisInstance}/keys/{key}”]->io.swagger.v3.oas.models.PathItem[“put”]->io.swagger.v3.oas.models.Operation[“requestBody”]->io.swagger.v3.oas.models.parameters.RequestBody[“content”]->io.swagger.v3.oas.models.media.Content[“/”]->io.swagger.v3.oas.models.media.MediaType[“schema”]->io.swagger.v3.oas.models.media.ObjectSchema[“properties”]->java.util.LinkedHashMap[“null”])

We found that code built in my IDE works, but the one built on my colleague IDE or via command line does not work. We think the issue is related to the name that is given to the Continuation parameter. On the code that works, its name is paramContinuation and on the one that does not work, its name is $completion. Our assumption is that Springdoc/Swagger doesn’t “like” this dollar sign in the name which leads to the exception above. You may be wondering if we’ve found the reason for this parameter name difference, but we didn’t 😞

2nd Issue If we run the code built in my IDE (the one which actually works), we can access Swagger. However, we see that the Continuation parameter is now part of it in every endpoint with a suspending function. This parameter is considered a request body or query parameter depending on the HTTP method (our guess). We would like to have this parameter removed from the endpoints.

Our questions:

  1. Do you have Kotlin Coroutines support on your roadmap (which may require ignoring Continuation parameters)?
  2. If not (or until you do) is there any possibility to instruct Springdoc/Swagger to simply ignore a given class so that we can work-around this issue?

Thanks and keep up the good work!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
simonherbertcommented, Jun 19, 2021

I’m still having this issue. Is there no solution?

Edit: For anyone having this issue (or myself later on), you need to add “org.springdoc:springdoc-openapi-kotlin” testImplementation dependency.

1reaction
joaodias14commented, Jan 15, 2020

Hi @jnfeinstein, yup we have no issues with kotlin-coroutines version 1.3.3 and springdoc-openapi version 1.2.18.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin/kotlinx.coroutines - GitHub
Library support for Kotlin coroutines . ... Add kotlinx-coroutines-android module as a dependency when using kotlinx.coroutines on Android:.
Read more >
Kotlin coroutines on Android
A coroutine is a concurrency design pattern that you can use on Android to simplify code that executes asynchronously. Coroutines were added ......
Read more >
Coroutines guide - Kotlin
In order to use coroutines as well as follow the examples in this guide, you need to add a dependency on the kotlinx-coroutines-core...
Read more >
Add Stable Coroutines to Android-Kotlin Project - Medium
Go to Tools → Kotlin → Configure Kotlin Plugin Updates, select “Stable” in the Update channel drop-down list, and then click Check for...
Read more >
Kotlin Coroutines in Android - ProAndroidDev
Coroutines were added to Kotlin in version 1.1. We need to add the following dependency of kotlinx.coroutines to the module-level build Gradle ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found