问题描述
我不明白为什么swagger-ui将“ columns”和“ documentIds”参数作为逗号分隔的值发送,而不是默认的爆炸式key = val1&key = val2形式发送。
这是定义:
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"
)
]
)
)
ExcelExportRequest:
internal class ExcelExportRequest {
@Schema(name = "columns",required = true)
var columns: List<String>? = null
@Schema(name = "documentIds",required = true)
var documentIds: List<String>? = null
}
使用swagger-2.1.2(OpenAPI v3)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)