[kotlin-spring] Adds 'suspend' modifier for reactive List endpoint with useFlowForArrayReturnType = false (#16130) (#20710)

This commit is contained in:
Ruslan Khasanshin
2025-02-23 15:35:08 +06:00
committed by GitHub
parent b80461373a
commit 79145dc633
8 changed files with 11 additions and 11 deletions

View File

@@ -84,7 +84,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
value = ["/pet/findByStatus"],
produces = ["application/xml", "application/json"]
)
fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
suspend fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200))
}
@@ -102,7 +102,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
value = ["/pet/findByTags"],
produces = ["application/xml", "application/json"]
)
fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
suspend fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200))
}

View File

@@ -37,7 +37,7 @@ interface PetApiService {
* or Invalid status value (status code 400)
* @see PetApi#findPetsByStatus
*/
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet>
suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet>
/**
* GET /pet/findByTags : Finds Pets by tags
@@ -49,7 +49,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>
suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>
/**
* GET /pet/{petId} : Find pet by ID

View File

@@ -15,11 +15,11 @@ class PetApiServiceImpl : PetApiService {
TODO("Implement me")
}
override fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet> {
override suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet> {
TODO("Implement me")
}
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet> {
override suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet> {
TODO("Implement me")
}