the Springdoc OpenAPI's @ParameterObject
annotation dosen't work when the Controller has @RequestPart
annotation
the dependency version:
- SpringBoot version is 3.2.4
- Springdoc OpenAPI version is 2.5.0
My Controller like this:
@Operation(summary = "upload file") @PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public FileInfo uploadFile(@ParameterObject FileInfoVO fileInfoVO, @RequestPart MultipartFile file) { System.out.println(fileInfoVO); return fileService.uploadFileInfo(fileInfoVO, file); }
the FileInfoVO:
public record FileInfoVO( @Schema(description = "creditId", requiredMode = REQUIRED) Long creditId, @Schema(description = "bucket name", requiredMode = REQUIRED) String bucketName, @Schema(description = "file key", requiredMode = NOT_REQUIRED) String fileKey) {}
When I upload the file with the params of FileInfoVO
, I got null like this:
FileInfoVO[creditId=null, bucketName=null, fileKey=null]
Is it a bug or I use it with wrong way?Help me pls, thx!