Kotlin Swagger UI以非分解形式发送表单参数
我不明白为什么“columns”和“documentid”参数被swagger ui作为逗号分隔的值发送,而不是作为默认的分解键=val1&key=val2形式发送 定义如下:Kotlin Swagger UI以非分解形式发送表单参数,kotlin,swagger,swagger-ui,openapi,Kotlin,Swagger,Swagger Ui,Openapi,我不明白为什么“columns”和“documentid”参数被swagger ui作为逗号分隔的值发送,而不是作为默认的分解键=val1&key=val2形式发送 定义如下: RouterOperation( path = "$BASE_PATH/loss/excel", beanClass = ExcelExportHandler::class, beanMethod = "
RouterOperation(
path = "$BASE_PATH/loss/excel",
beanClass = ExcelExportHandler::class,
beanMethod = "export",
method = [POST],
operation = Operation(
operationId = "excelExport",
security = [
SecurityRequirement(name = "Authorization")
],
requestBody = RequestBody(
required = true,
description = "form data",
content = [
Content(
mediaType = APPLICATION_FORM_URLENCODED_VALUE,
schema = Schema(implementation = ExcelExportRequest::class),
encoding = [
Encoding(name = "columns", explode = true),
Encoding(name = "documentIds", explode = true)
]
)
],
),
responses = [
ApiResponse(
content = [
Content(
mediaType = APPLICATION_OCTET_STREAM_VALUE
)
]
),
ApiResponse(
responseCode = "200"
)
]
)
)
请求:
internal class ExcelExportRequest {
@Schema(name = "columns", required = true)
var columns: List<String>? = null
@Schema(name = "documentIds", required = true)
var documentIds: List<String>? = null
}
内部类请求{
@架构(name=“columns”,required=true)
变量列:列表?=null
@架构(name=“documentIds”,required=true)
var documentIds:列表?=null
}
使用swagger-2.1.2(OpenAPI v3)