forked from loafle/openapi-generator-original
fix #18555 kotlin-spring generator flag appendRequestToHandler generates broken code when used with flag delegatePattern (#19206)
This commit is contained in:
parent
e40d3228aa
commit
08e2653935
@ -8,5 +8,6 @@ additionalProperties:
|
|||||||
annotationLibrary: swagger2
|
annotationLibrary: swagger2
|
||||||
useSwaggerUI: "true"
|
useSwaggerUI: "true"
|
||||||
delegatePattern: "true"
|
delegatePattern: "true"
|
||||||
|
appendRequestToHandler: "true"
|
||||||
beanValidations: "true"
|
beanValidations: "true"
|
||||||
requestMappingMode: none
|
requestMappingMode: none
|
||||||
|
@ -875,7 +875,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
|||||||
final List<CodegenParameter> allParams = operation.allParams;
|
final List<CodegenParameter> allParams = operation.allParams;
|
||||||
if (allParams != null) {
|
if (allParams != null) {
|
||||||
if (this.isAppendRequestToHandler()) {
|
if (this.isAppendRequestToHandler()) {
|
||||||
allParams.add(new RequestCodegenParameter(true));
|
allParams.add(new RequestCodegenParameter());
|
||||||
}
|
}
|
||||||
allParams.forEach(param ->
|
allParams.forEach(param ->
|
||||||
// This is necessary in case 'modelMutable' is enabled,
|
// This is necessary in case 'modelMutable' is enabled,
|
||||||
@ -972,7 +972,16 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
static class RequestCodegenParameter extends CodegenParameter {
|
static class RequestCodegenParameter extends CodegenParameter {
|
||||||
boolean isRequestObject;
|
|
||||||
|
boolean isRequestObject = true;
|
||||||
|
|
||||||
|
public RequestCodegenParameter() {
|
||||||
|
this.isOptional = false;
|
||||||
|
this.required = true;
|
||||||
|
this.paramName = "serverHttpRequest";
|
||||||
|
this.dataType = "ServerHttpRequest";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestMappingMode getRequestMappingMode() {
|
public RequestMappingMode getRequestMappingMode() {
|
||||||
|
@ -7,6 +7,9 @@ import org.springframework.http.MediaType
|
|||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.web.context.request.NativeWebRequest
|
import org.springframework.web.context.request.NativeWebRequest
|
||||||
import org.springframework.core.io.Resource
|
import org.springframework.core.io.Resource
|
||||||
|
{{#appendRequestToHandler}}
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
{{/appendRequestToHandler}}
|
||||||
{{#reactive}}
|
{{#reactive}}
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
{{/reactive}}
|
{{/reactive}}
|
||||||
|
@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.security.*
|
|||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
import org.springframework.http.MediaType
|
import org.springframework.http.MediaType
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.validation.annotation.Validated
|
import org.springframework.validation.annotation.Validated
|
||||||
@ -57,8 +58,8 @@ interface PetApi {
|
|||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
consumes = ["application/json", "application/xml"]
|
consumes = ["application/json", "application/xml"]
|
||||||
)
|
)
|
||||||
fun addPet(@Parameter(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody pet: Pet): ResponseEntity<Pet> {
|
fun addPet(@Parameter(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody pet: Pet,serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
|
||||||
return getDelegate().addPet(pet)
|
return getDelegate().addPet(pet, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -75,8 +76,8 @@ interface PetApi {
|
|||||||
method = [RequestMethod.DELETE],
|
method = [RequestMethod.DELETE],
|
||||||
value = ["/pet/{petId}"]
|
value = ["/pet/{petId}"]
|
||||||
)
|
)
|
||||||
fun deletePet(@Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "", `in` = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?): ResponseEntity<Unit> {
|
fun deletePet(@Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "", `in` = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().deletePet(petId, apiKey)
|
return getDelegate().deletePet(petId, apiKey, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -95,8 +96,8 @@ interface PetApi {
|
|||||||
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>> {
|
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>,serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
|
||||||
return getDelegate().findPetsByStatus(status)
|
return getDelegate().findPetsByStatus(status, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -115,8 +116,8 @@ interface PetApi {
|
|||||||
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>> {
|
fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>,serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
|
||||||
return getDelegate().findPetsByTags(tags)
|
return getDelegate().findPetsByTags(tags, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -136,8 +137,8 @@ interface PetApi {
|
|||||||
value = ["/pet/{petId}"],
|
value = ["/pet/{petId}"],
|
||||||
produces = ["application/xml", "application/json"]
|
produces = ["application/xml", "application/json"]
|
||||||
)
|
)
|
||||||
fun getPetById(@Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") petId: kotlin.Long): ResponseEntity<Pet> {
|
fun getPetById(@Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") petId: kotlin.Long,serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
|
||||||
return getDelegate().getPetById(petId)
|
return getDelegate().getPetById(petId, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -159,8 +160,8 @@ interface PetApi {
|
|||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
consumes = ["application/json", "application/xml"]
|
consumes = ["application/json", "application/xml"]
|
||||||
)
|
)
|
||||||
fun updatePet(@Parameter(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody pet: Pet): ResponseEntity<Pet> {
|
fun updatePet(@Parameter(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody pet: Pet,serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
|
||||||
return getDelegate().updatePet(pet)
|
return getDelegate().updatePet(pet, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -178,8 +179,8 @@ interface PetApi {
|
|||||||
value = ["/pet/{petId}"],
|
value = ["/pet/{petId}"],
|
||||||
consumes = ["application/x-www-form-urlencoded"]
|
consumes = ["application/x-www-form-urlencoded"]
|
||||||
)
|
)
|
||||||
fun updatePetWithForm(@Parameter(description = "ID of pet that needs to be updated", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Updated name of the pet") @RequestParam(value = "name", required = false) name: kotlin.String? ,@Parameter(description = "Updated status of the pet") @RequestParam(value = "status", required = false) status: kotlin.String? ): ResponseEntity<Unit> {
|
fun updatePetWithForm(@Parameter(description = "ID of pet that needs to be updated", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Updated name of the pet") @RequestParam(value = "name", required = false) name: kotlin.String? ,@Parameter(description = "Updated status of the pet") @RequestParam(value = "status", required = false) status: kotlin.String? ,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().updatePetWithForm(petId, name, status)
|
return getDelegate().updatePetWithForm(petId, name, status, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -198,7 +199,7 @@ interface PetApi {
|
|||||||
produces = ["application/json"],
|
produces = ["application/json"],
|
||||||
consumes = ["multipart/form-data"]
|
consumes = ["multipart/form-data"]
|
||||||
)
|
)
|
||||||
fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity<ModelApiResponse> {
|
fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?,serverHttpRequest: ServerHttpRequest): ResponseEntity<ModelApiResponse> {
|
||||||
return getDelegate().uploadFile(petId, additionalMetadata, file)
|
return getDelegate().uploadFile(petId, additionalMetadata, file, serverHttpRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.springframework.http.MediaType
|
|||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.web.context.request.NativeWebRequest
|
import org.springframework.web.context.request.NativeWebRequest
|
||||||
import org.springframework.core.io.Resource
|
import org.springframework.core.io.Resource
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
|
||||||
@ -22,7 +23,8 @@ interface PetApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see PetApi#addPet
|
* @see PetApi#addPet
|
||||||
*/
|
*/
|
||||||
fun addPet(pet: Pet): ResponseEntity<Pet> {
|
fun addPet(pet: Pet,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -44,7 +46,8 @@ interface PetApiDelegate {
|
|||||||
* @see PetApi#deletePet
|
* @see PetApi#deletePet
|
||||||
*/
|
*/
|
||||||
fun deletePet(petId: kotlin.Long,
|
fun deletePet(petId: kotlin.Long,
|
||||||
apiKey: kotlin.String?): ResponseEntity<Unit> {
|
apiKey: kotlin.String?,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -53,7 +56,8 @@ interface PetApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see PetApi#findPetsByStatus
|
* @see PetApi#findPetsByStatus
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -74,7 +78,8 @@ interface PetApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see PetApi#findPetsByTags
|
* @see PetApi#findPetsByTags
|
||||||
*/
|
*/
|
||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -95,7 +100,8 @@ interface PetApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see PetApi#getPetById
|
* @see PetApi#getPetById
|
||||||
*/
|
*/
|
||||||
fun getPetById(petId: kotlin.Long): ResponseEntity<Pet> {
|
fun getPetById(petId: kotlin.Long,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -116,7 +122,8 @@ interface PetApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see PetApi#updatePet
|
* @see PetApi#updatePet
|
||||||
*/
|
*/
|
||||||
fun updatePet(pet: Pet): ResponseEntity<Pet> {
|
fun updatePet(pet: Pet,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -139,7 +146,8 @@ interface PetApiDelegate {
|
|||||||
*/
|
*/
|
||||||
fun updatePetWithForm(petId: kotlin.Long,
|
fun updatePetWithForm(petId: kotlin.Long,
|
||||||
name: kotlin.String?,
|
name: kotlin.String?,
|
||||||
status: kotlin.String?): ResponseEntity<Unit> {
|
status: kotlin.String?,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -150,7 +158,8 @@ interface PetApiDelegate {
|
|||||||
*/
|
*/
|
||||||
fun uploadFile(petId: kotlin.Long,
|
fun uploadFile(petId: kotlin.Long,
|
||||||
additionalMetadata: kotlin.String?,
|
additionalMetadata: kotlin.String?,
|
||||||
file: Resource?): ResponseEntity<ModelApiResponse> {
|
file: Resource?,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<ModelApiResponse> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
|
@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.security.*
|
|||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
import org.springframework.http.MediaType
|
import org.springframework.http.MediaType
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.validation.annotation.Validated
|
import org.springframework.validation.annotation.Validated
|
||||||
@ -53,8 +54,8 @@ interface StoreApi {
|
|||||||
method = [RequestMethod.DELETE],
|
method = [RequestMethod.DELETE],
|
||||||
value = ["/store/order/{orderId}"]
|
value = ["/store/order/{orderId}"]
|
||||||
)
|
)
|
||||||
fun deleteOrder(@Parameter(description = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") orderId: kotlin.String): ResponseEntity<Unit> {
|
fun deleteOrder(@Parameter(description = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") orderId: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().deleteOrder(orderId)
|
return getDelegate().deleteOrder(orderId, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -72,8 +73,8 @@ interface StoreApi {
|
|||||||
value = ["/store/inventory"],
|
value = ["/store/inventory"],
|
||||||
produces = ["application/json"]
|
produces = ["application/json"]
|
||||||
)
|
)
|
||||||
fun getInventory(): ResponseEntity<Map<String, kotlin.Int>> {
|
fun getInventory(serverHttpRequest: ServerHttpRequest): ResponseEntity<Map<String, kotlin.Int>> {
|
||||||
return getDelegate().getInventory()
|
return getDelegate().getInventory(serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -92,8 +93,8 @@ interface StoreApi {
|
|||||||
value = ["/store/order/{orderId}"],
|
value = ["/store/order/{orderId}"],
|
||||||
produces = ["application/xml", "application/json"]
|
produces = ["application/xml", "application/json"]
|
||||||
)
|
)
|
||||||
fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity<Order> {
|
fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long,serverHttpRequest: ServerHttpRequest): ResponseEntity<Order> {
|
||||||
return getDelegate().getOrderById(orderId)
|
return getDelegate().getOrderById(orderId, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -112,7 +113,7 @@ interface StoreApi {
|
|||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
consumes = ["application/json"]
|
consumes = ["application/json"]
|
||||||
)
|
)
|
||||||
fun placeOrder(@Parameter(description = "order placed for purchasing the pet", required = true) @Valid @RequestBody order: Order): ResponseEntity<Order> {
|
fun placeOrder(@Parameter(description = "order placed for purchasing the pet", required = true) @Valid @RequestBody order: Order,serverHttpRequest: ServerHttpRequest): ResponseEntity<Order> {
|
||||||
return getDelegate().placeOrder(order)
|
return getDelegate().placeOrder(order, serverHttpRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import org.springframework.http.MediaType
|
|||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.web.context.request.NativeWebRequest
|
import org.springframework.web.context.request.NativeWebRequest
|
||||||
import org.springframework.core.io.Resource
|
import org.springframework.core.io.Resource
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
|
||||||
@ -21,7 +22,8 @@ interface StoreApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see StoreApi#deleteOrder
|
* @see StoreApi#deleteOrder
|
||||||
*/
|
*/
|
||||||
fun deleteOrder(orderId: kotlin.String): ResponseEntity<Unit> {
|
fun deleteOrder(orderId: kotlin.String,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -30,7 +32,7 @@ interface StoreApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see StoreApi#getInventory
|
* @see StoreApi#getInventory
|
||||||
*/
|
*/
|
||||||
fun getInventory(): ResponseEntity<Map<String, kotlin.Int>> {
|
fun getInventory(serverHttpRequest: ServerHttpRequest): ResponseEntity<Map<String, kotlin.Int>> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,7 +41,8 @@ interface StoreApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see StoreApi#getOrderById
|
* @see StoreApi#getOrderById
|
||||||
*/
|
*/
|
||||||
fun getOrderById(orderId: kotlin.Long): ResponseEntity<Order> {
|
fun getOrderById(orderId: kotlin.Long,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Order> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -60,7 +63,8 @@ interface StoreApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see StoreApi#placeOrder
|
* @see StoreApi#placeOrder
|
||||||
*/
|
*/
|
||||||
fun placeOrder(order: Order): ResponseEntity<Order> {
|
fun placeOrder(order: Order,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Order> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
|
@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.security.*
|
|||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
import org.springframework.http.MediaType
|
import org.springframework.http.MediaType
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.validation.annotation.Validated
|
import org.springframework.validation.annotation.Validated
|
||||||
@ -54,8 +55,8 @@ interface UserApi {
|
|||||||
value = ["/user"],
|
value = ["/user"],
|
||||||
consumes = ["application/json"]
|
consumes = ["application/json"]
|
||||||
)
|
)
|
||||||
fun createUser(@Parameter(description = "Created user object", required = true) @Valid @RequestBody user: User): ResponseEntity<Unit> {
|
fun createUser(@Parameter(description = "Created user object", required = true) @Valid @RequestBody user: User,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().createUser(user)
|
return getDelegate().createUser(user, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -73,8 +74,8 @@ interface UserApi {
|
|||||||
value = ["/user/createWithArray"],
|
value = ["/user/createWithArray"],
|
||||||
consumes = ["application/json"]
|
consumes = ["application/json"]
|
||||||
)
|
)
|
||||||
fun createUsersWithArrayInput(@Parameter(description = "List of user object", required = true) @Valid @RequestBody user: kotlin.collections.List<User>): ResponseEntity<Unit> {
|
fun createUsersWithArrayInput(@Parameter(description = "List of user object", required = true) @Valid @RequestBody user: kotlin.collections.List<User>,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().createUsersWithArrayInput(user)
|
return getDelegate().createUsersWithArrayInput(user, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -92,8 +93,8 @@ interface UserApi {
|
|||||||
value = ["/user/createWithList"],
|
value = ["/user/createWithList"],
|
||||||
consumes = ["application/json"]
|
consumes = ["application/json"]
|
||||||
)
|
)
|
||||||
fun createUsersWithListInput(@Parameter(description = "List of user object", required = true) @Valid @RequestBody user: kotlin.collections.List<User>): ResponseEntity<Unit> {
|
fun createUsersWithListInput(@Parameter(description = "List of user object", required = true) @Valid @RequestBody user: kotlin.collections.List<User>,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().createUsersWithListInput(user)
|
return getDelegate().createUsersWithListInput(user, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -111,8 +112,8 @@ interface UserApi {
|
|||||||
method = [RequestMethod.DELETE],
|
method = [RequestMethod.DELETE],
|
||||||
value = ["/user/{username}"]
|
value = ["/user/{username}"]
|
||||||
)
|
)
|
||||||
fun deleteUser(@Parameter(description = "The name that needs to be deleted", required = true) @PathVariable("username") username: kotlin.String): ResponseEntity<Unit> {
|
fun deleteUser(@Parameter(description = "The name that needs to be deleted", required = true) @PathVariable("username") username: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().deleteUser(username)
|
return getDelegate().deleteUser(username, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -131,8 +132,8 @@ interface UserApi {
|
|||||||
value = ["/user/{username}"],
|
value = ["/user/{username}"],
|
||||||
produces = ["application/xml", "application/json"]
|
produces = ["application/xml", "application/json"]
|
||||||
)
|
)
|
||||||
fun getUserByName(@Parameter(description = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") username: kotlin.String): ResponseEntity<User> {
|
fun getUserByName(@Parameter(description = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") username: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<User> {
|
||||||
return getDelegate().getUserByName(username)
|
return getDelegate().getUserByName(username, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -150,8 +151,8 @@ interface UserApi {
|
|||||||
value = ["/user/login"],
|
value = ["/user/login"],
|
||||||
produces = ["application/xml", "application/json"]
|
produces = ["application/xml", "application/json"]
|
||||||
)
|
)
|
||||||
fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity<kotlin.String> {
|
fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<kotlin.String> {
|
||||||
return getDelegate().loginUser(username, password)
|
return getDelegate().loginUser(username, password, serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -168,8 +169,8 @@ interface UserApi {
|
|||||||
method = [RequestMethod.GET],
|
method = [RequestMethod.GET],
|
||||||
value = ["/user/logout"]
|
value = ["/user/logout"]
|
||||||
)
|
)
|
||||||
fun logoutUser(): ResponseEntity<Unit> {
|
fun logoutUser(serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().logoutUser()
|
return getDelegate().logoutUser(serverHttpRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -188,7 +189,7 @@ interface UserApi {
|
|||||||
value = ["/user/{username}"],
|
value = ["/user/{username}"],
|
||||||
consumes = ["application/json"]
|
consumes = ["application/json"]
|
||||||
)
|
)
|
||||||
fun updateUser(@Parameter(description = "name that need to be deleted", required = true) @PathVariable("username") username: kotlin.String,@Parameter(description = "Updated user object", required = true) @Valid @RequestBody user: User): ResponseEntity<Unit> {
|
fun updateUser(@Parameter(description = "name that need to be deleted", required = true) @PathVariable("username") username: kotlin.String,@Parameter(description = "Updated user object", required = true) @Valid @RequestBody user: User,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return getDelegate().updateUser(username, user)
|
return getDelegate().updateUser(username, user, serverHttpRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import org.springframework.http.MediaType
|
|||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.web.context.request.NativeWebRequest
|
import org.springframework.web.context.request.NativeWebRequest
|
||||||
import org.springframework.core.io.Resource
|
import org.springframework.core.io.Resource
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest
|
||||||
|
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
|
||||||
@ -21,7 +22,8 @@ interface UserApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see UserApi#createUser
|
* @see UserApi#createUser
|
||||||
*/
|
*/
|
||||||
fun createUser(user: User): ResponseEntity<Unit> {
|
fun createUser(user: User,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -30,7 +32,8 @@ interface UserApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see UserApi#createUsersWithArrayInput
|
* @see UserApi#createUsersWithArrayInput
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInput(user: kotlin.collections.List<User>): ResponseEntity<Unit> {
|
fun createUsersWithArrayInput(user: kotlin.collections.List<User>,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,7 +42,8 @@ interface UserApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see UserApi#createUsersWithListInput
|
* @see UserApi#createUsersWithListInput
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInput(user: kotlin.collections.List<User>): ResponseEntity<Unit> {
|
fun createUsersWithListInput(user: kotlin.collections.List<User>,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -48,7 +52,8 @@ interface UserApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see UserApi#deleteUser
|
* @see UserApi#deleteUser
|
||||||
*/
|
*/
|
||||||
fun deleteUser(username: kotlin.String): ResponseEntity<Unit> {
|
fun deleteUser(username: kotlin.String,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -57,7 +62,8 @@ interface UserApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see UserApi#getUserByName
|
* @see UserApi#getUserByName
|
||||||
*/
|
*/
|
||||||
fun getUserByName(username: kotlin.String): ResponseEntity<User> {
|
fun getUserByName(username: kotlin.String,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<User> {
|
||||||
getRequest().ifPresent { request ->
|
getRequest().ifPresent { request ->
|
||||||
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||||
@ -79,7 +85,8 @@ interface UserApiDelegate {
|
|||||||
* @see UserApi#loginUser
|
* @see UserApi#loginUser
|
||||||
*/
|
*/
|
||||||
fun loginUser(username: kotlin.String,
|
fun loginUser(username: kotlin.String,
|
||||||
password: kotlin.String): ResponseEntity<kotlin.String> {
|
password: kotlin.String,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<kotlin.String> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -88,7 +95,7 @@ interface UserApiDelegate {
|
|||||||
/**
|
/**
|
||||||
* @see UserApi#logoutUser
|
* @see UserApi#logoutUser
|
||||||
*/
|
*/
|
||||||
fun logoutUser(): ResponseEntity<Unit> {
|
fun logoutUser(serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -98,7 +105,8 @@ interface UserApiDelegate {
|
|||||||
* @see UserApi#updateUser
|
* @see UserApi#updateUser
|
||||||
*/
|
*/
|
||||||
fun updateUser(username: kotlin.String,
|
fun updateUser(username: kotlin.String,
|
||||||
user: User): ResponseEntity<Unit> {
|
user: User,
|
||||||
|
serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user