springfox-swagger2 UI是否支持一次选择多个文件? [英] Does springfox-swagger2 UI support choosing multiple files at once?
问题描述
我使用Spring Boot和集成的swagger-ui(springfox-swagger2),并且希望能够选择一次上传多个文件.不幸的是,Swagger UI似乎不允许这样做,至少没有提供我的控制器方法.
I use Spring Boot and integrated swagger-ui (springfox-swagger2) and I want to be able to choose to upload multiple files at once. Unfortunately the Swagger UI doesn't appear to allow this, at least not give my controller method.
我的控制器方法签名:
@ApiOperation(
value = "batch upload goods cover image",
notes = "batch upload goods cover image",
response = UploadCoverResultDTO.class,
responseContainer = "List"
)
public Result<?> uploadGoodsCover(@ApiParam(value = "Image array", allowMultiple = true,
required = true) @RequestPart("image") MultipartFile[] files) throws IOException {
Swagger用户界面生成:
Swagger UI generated:
但是我期待一个类似于以下的用户界面:
But I was expecting a UI similar to this:
一次选择一个文件夹中的所有图片比一次选择一张更方便,例如:
It's more convenient to choose all pictures in a folder in one go rather than choose one at a time e.g.:
<input type="file" name="img" multiple="multiple"/>
springfox-swagger2支持吗?如果是这样,我需要进行哪些更改?
Does springfox-swagger2 support this? If so, what changes do I need to make?
推荐答案
更新:@Helen指出,Swagger 3.26.0和OpenAPI 3现在支持此功能,并且应该在Springfox 3的下一版本
Update: as pointed out by @Helen, this is now supported in Swagger 3.26.0 with OpenAPI 3 and should be in the next release of Springfox 3
Springfox 2:不幸的是,答案是否.
Springfox Swagger2不支持此功能,因为Swagger尚不支持: https://github .com/springfox/springfox/issues/1072
Springfox Swagger2 does not support this because it's not yet supported by Swagger: https://github.com/springfox/springfox/issues/1072
相关的Swagger问题:
https://github.com/swagger-api/swagger-ui/issues/4600 (已在3.26.0中修复)
https://github.com/OAI/OpenAPI-Specification/issues/254
Relevant Swagger issues:
https://github.com/swagger-api/swagger-ui/issues/4600 (fixed in 3.26.0)
https://github.com/OAI/OpenAPI-Specification/issues/254
这篇关于springfox-swagger2 UI是否支持一次选择多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!