forked from loafle/openapi-generator-original
[kotlin-spring] Adds 'suspend' modifier for reactive List endpoint with useFlowForArrayReturnType = false (#16130) (#20710)
This commit is contained in:
parent
b80461373a
commit
79145dc633
@ -89,7 +89,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
|
|||||||
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
|
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
|
||||||
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
|
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
|
||||||
)
|
)
|
||||||
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> {
|
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> {
|
||||||
return {{>returnValue}}
|
return {{>returnValue}}
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
@ -32,7 +32,7 @@ interface {{classname}}Delegate {
|
|||||||
/**
|
/**
|
||||||
* @see {{classname}}#{{operationId}}
|
* @see {{classname}}#{{operationId}}
|
||||||
*/
|
*/
|
||||||
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}{{#isBodyParam}}Flow<{{{baseType}}}>{{/isBodyParam}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{/isArray}}{{/reactive}}{{^-last}},
|
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}{{#isBodyParam}}Flow<{{{baseType}}}>{{/isBodyParam}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{/isArray}}{{/reactive}}{{^-last}},
|
||||||
{{/-last}}{{/allParams}}): {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}}{{^skipDefaultDelegateInterface}} {
|
{{/-last}}{{/allParams}}): {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}}{{^skipDefaultDelegateInterface}} {
|
||||||
{{>methodBody}}
|
{{>methodBody}}
|
||||||
}{{/skipDefaultDelegateInterface}}
|
}{{/skipDefaultDelegateInterface}}
|
||||||
|
@ -102,7 +102,7 @@ interface {{classname}} {
|
|||||||
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
|
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
|
||||||
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
|
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
|
||||||
)
|
)
|
||||||
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}>{{^skipDefaultApiInterface}} {
|
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}>{{^skipDefaultApiInterface}} {
|
||||||
{{^isDelegate}}
|
{{^isDelegate}}
|
||||||
return {{>returnValue}}
|
return {{>returnValue}}
|
||||||
{{/isDelegate}}
|
{{/isDelegate}}
|
||||||
|
@ -30,7 +30,7 @@ interface {{classname}}Service {
|
|||||||
{{/externalDocs}}
|
{{/externalDocs}}
|
||||||
* @see {{classname}}#{{operationId}}
|
* @see {{classname}}#{{operationId}}
|
||||||
*/
|
*/
|
||||||
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}): {{>returnTypes}}
|
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}): {{>returnTypes}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Service
|
|||||||
class {{classname}}ServiceImpl : {{classname}}Service {
|
class {{classname}}ServiceImpl : {{classname}}Service {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
override {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}): {{>returnTypes}} {
|
override {{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}): {{>returnTypes}} {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
@ -84,7 +84,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
value = ["/pet/findByStatus"],
|
value = ["/pet/findByStatus"],
|
||||||
produces = ["application/xml", "application/json"]
|
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))
|
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
value = ["/pet/findByTags"],
|
value = ["/pet/findByTags"],
|
||||||
produces = ["application/xml", "application/json"]
|
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))
|
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ interface PetApiService {
|
|||||||
* or Invalid status value (status code 400)
|
* or Invalid status value (status code 400)
|
||||||
* @see PetApi#findPetsByStatus
|
* @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
|
* GET /pet/findByTags : Finds Pets by tags
|
||||||
@ -49,7 +49,7 @@ interface PetApiService {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
* @see PetApi#findPetsByTags
|
* @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
|
* GET /pet/{petId} : Find pet by ID
|
||||||
|
@ -15,11 +15,11 @@ class PetApiServiceImpl : PetApiService {
|
|||||||
TODO("Implement me")
|
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")
|
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")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user