Add support for Kotlin Coroutines
See original GitHub issueKotlin 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:
- Do you have Kotlin Coroutines support on your roadmap (which may require ignoring
Continuation
parameters)? - 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:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
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.
Hi @jnfeinstein, yup we have no issues with kotlin-coroutines version 1.3.3 and springdoc-openapi version 1.2.18.