diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date
index 8cf31ae0c51..52256708c55 100755
--- a/bin/utils/ensure-up-to-date
+++ b/bin/utils/ensure-up-to-date
@@ -25,6 +25,7 @@ declare -a scripts=(
"./bin/kotlin-client-threetenbp.sh"
"./bin/kotlin-server-petstore.sh"
"./bin/kotlin-springboot-petstore-server.sh"
+"./bin/kotlin-springboot-petstore-server-reactive.sh"
"./bin/mysql-schema-petstore.sh"
"./bin/python-petstore-all.sh"
"./bin/openapi3/python-petstore.sh"
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache
index f94e84c24de..fc21b3353cc 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache
@@ -4,6 +4,10 @@ package {{package}}
{{/imports}}
import org.junit.jupiter.api.Test
+{{#reactive}}
+import kotlinx.coroutines.flow.Flow;
+import kotlinx.coroutines.test.runBlockingTest
+{{/reactive}}
import org.springframework.http.ResponseEntity
class {{classname}}Test {
@@ -21,7 +25,7 @@ class {{classname}}Test {
* if the Api call fails
*/
@Test
- fun {{operationId}}Test() {
+ fun {{operationId}}Test() {{#reactive}}= runBlockingTest {{/reactive}}{
{{#allParams}}
val {{paramName}}:{{{dataType}}}? = null
{{/allParams}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache
index 7c5a1991b49..dac8996120d 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache
@@ -54,6 +54,9 @@ dependencies {
testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit")
}
+{{#reactive}}
+ testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion")
+{{/reactive}}
}
repositories {
diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION
index 06b5019af3f..d96260ba335 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION
+++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION
@@ -1 +1 @@
-4.0.1-SNAPSHOT
\ No newline at end of file
+4.0.2-SNAPSHOT
\ No newline at end of file
diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts
index f62d3f33c8d..f4561be14be 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts
+++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts
@@ -43,9 +43,11 @@ dependencies {
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
+ testCompile("org.jetbrains.kotlin:kotlin-test-junit5")
testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit")
}
+ testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion")
}
repositories {
diff --git a/samples/server/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/petstore/kotlin-springboot-reactive/pom.xml
index 1932017d4bf..c8683e54bc2 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/pom.xml
+++ b/samples/server/petstore/kotlin-springboot-reactive/pom.xml
@@ -117,6 +117,12 @@
javax.validation
validation-api
+
+ org.jetbrains.kotlin
+ kotlin-test-junit5
+ 1.3.31
+ test
+
diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt
index 380c94d5acb..c8273a4ac4a 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt
+++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt
@@ -57,7 +57,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
method = [RequestMethod.POST])
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
): ResponseEntity {
- return ResponseEntity(service.addPet(body), HttpStatus.OK)
+ return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405))
}
@ApiOperation(
@@ -70,10 +70,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
@RequestMapping(
value = ["/pet/{petId}"],
method = [RequestMethod.DELETE])
- suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long
-,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?
+ suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long
+,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String?
): ResponseEntity {
- return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
+ return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400))
}
@ApiOperation(
@@ -89,9 +89,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
value = ["/pet/findByStatus"],
produces = ["application/xml", "application/json"],
method = [RequestMethod.GET])
- fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List
+ fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List
): ResponseEntity> {
- return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
+ return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200))
}
@ApiOperation(
@@ -107,9 +107,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
value = ["/pet/findByTags"],
produces = ["application/xml", "application/json"],
method = [RequestMethod.GET])
- fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List
+ fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List
): ResponseEntity> {
- return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK)
+ return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200))
}
@ApiOperation(
@@ -124,9 +124,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
value = ["/pet/{petId}"],
produces = ["application/xml", "application/json"],
method = [RequestMethod.GET])
- suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long
+ suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long
): ResponseEntity {
- return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
+ return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200))
}
@ApiOperation(
@@ -142,7 +142,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
method = [RequestMethod.PUT])
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
): ResponseEntity {
- return ResponseEntity(service.updatePet(body), HttpStatus.OK)
+ return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400))
}
@ApiOperation(
@@ -156,11 +156,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
value = ["/pet/{petId}"],
consumes = ["application/x-www-form-urlencoded"],
method = [RequestMethod.POST])
- suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long
-,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String?
-,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String?
+ suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long
+,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String?
+,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String?
): ResponseEntity {
- return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
+ return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405))
}
@ApiOperation(
@@ -176,10 +176,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
produces = ["application/json"],
consumes = ["multipart/form-data"],
method = [RequestMethod.POST])
- suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long
-,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String?
+ suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long
+,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String?
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
): ResponseEntity {
- return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
+ return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200))
}
}
diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt
index 613d30d3b1f..572dfddca6a 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt
+++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt
@@ -7,17 +7,17 @@ interface PetApiService {
suspend fun addPet(body: Pet): Unit
- suspend fun deletePet(petId: Long, apiKey: String?): Unit
+ suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit
- fun findPetsByStatus(status: List): Flow
+ fun findPetsByStatus(status: kotlin.collections.List): Flow
- fun findPetsByTags(tags: List): Flow
+ fun findPetsByTags(tags: kotlin.collections.List): Flow
- suspend fun getPetById(petId: Long): Pet
+ suspend fun getPetById(petId: kotlin.Long): Pet
suspend fun updatePet(body: Pet): Unit
- suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
+ suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit
- suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
+ suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse
}
diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt
index 56dee71b00c..1013dd81f92 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt
+++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt
@@ -11,19 +11,19 @@ class PetApiServiceImpl : PetApiService {
TODO("Implement me")
}
- override suspend fun deletePet(petId: Long, apiKey: String?): Unit {
+ override suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit {
TODO("Implement me")
}
- override fun findPetsByStatus(status: List): Flow {
+ override fun findPetsByStatus(status: kotlin.collections.List): Flow {
TODO("Implement me")
}
- override fun findPetsByTags(tags: List): Flow {
+ override fun findPetsByTags(tags: kotlin.collections.List): Flow {
TODO("Implement me")
}
- override suspend fun getPetById(petId: Long): Pet {
+ override suspend fun getPetById(petId: kotlin.Long): Pet {
TODO("Implement me")
}
@@ -31,11 +31,11 @@ class PetApiServiceImpl : PetApiService {
TODO("Implement me")
}
- override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
+ override suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit {
TODO("Implement me")
}
- override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
+ override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
TODO("Implement me")
}
}
diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt
index 50840e05720..c02953e92ad 100644
--- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt
+++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt
@@ -52,26 +52,26 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
@RequestMapping(
value = ["/store/order/{orderId}"],
method = [RequestMethod.DELETE])
- suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String
+ suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String
): ResponseEntity {
- return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK)
+ return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400))
}
@ApiOperation(
value = "Returns pet inventories by status",
nickname = "getInventory",
notes = "Returns a map of status codes to quantities",
- response = Int::class,
+ response = kotlin.Int::class,
responseContainer = "Map",
authorizations = [Authorization(value = "api_key")])
@ApiResponses(
- value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")])
+ value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")])
@RequestMapping(
value = ["/store/inventory"],
produces = ["application/json"],
method = [RequestMethod.GET])
- suspend fun getInventory(): ResponseEntity