我正在使用swagger记录REST API,但文件上传无法通过swagger接口工作。文件即将为空。
@PostMapping(value = "upload")
@ApiOperation(value = "Upload a Document",
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantId", required = true, paramType = "header"),
@ApiImplicitParam(name = "docImageOne", required = true, dataType = "file", paramType = "body"),
@ApiImplicitParam(name = "docImageTwo", dataType = "file", paramType = "body"),
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = UploadResponse.class),
@ApiResponse(code = 400, message = "Bad Request"),
@ApiResponse(code = 404, message = "Not Found"),
@ApiResponse(code = 500, message = "Failure")})
public ResponseEntity<?> identify(final @RequestHeader HttpHeaders headers,
final @RequestBody MultipartFile docImageOne,
final @RequestBody Optional<MultipartFile> docImageTwo)
{}
不确定我缺少什么,任何指针都会非常感激。