如何解决Swagger-UI将表单参数发送为未爆炸
我不明白为什么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 举报,一经查实,本站将立刻删除。