我使用Spring Boot和集成的swagger-ui(springfox-swagger2),我希望能够选择一次上传多个文件。不幸的是,Swagger UI似乎不允许这样做,至少不会给我的控制器方法。
我的控制器方法签名:
@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 {
一次选择文件夹中的所有图片比一次选择一张图片更方便,例如:
<input type="file" name="img" multiple="multiple"/>
springfox-swagger2是否支持此功能?如果是这样,我需要做出哪些改变?
答案 0 :(得分:1)
很遗憾,答案是否。
Springfox Swagger2不支持此功能,因为Swagger尚不支持:https://github.com/springfox/springfox/issues/1072
相关的Swagger问题:
https://github.com/swagger-api/swagger-ui/issues/4600
https://github.com/OAI/OpenAPI-Specification/issues/254