Forum Discussion

lmpampaletakis's avatar
4 years ago

Multipart form with other fields

Hi all,


I hope that my question will be clear. I am trying to setup swagger at a spring boot web service. My method takes as a parmeter an object that contains fields and an upload file field. The rest method is POST. I can see it at swagger ui, and I also can make a request. The problem is that I cannot set the order of the fields and mark some of them as required. 
Here is my controller:

@ApiOperation(value = "Method used to sign pdf/docx files", consumes = "multipart/form-data")
public ResponseEntity<byte[]> test(HttpServletRequest request, SignatureRequest signatureRequest) {

 The SignatureRequest is something like:

@ApiModelProperty(required = true, position = 1)
private String username;
@ApiModelProperty(required = true, position = 2)
private String password;
@ApiModelProperty(required = true, position = 3)
private Integer otp;
@ApiModelProperty(required = true, position = 4)
private String apiKey;
@ApiModelProperty(required = true, position = 5)
private MultipartFile multipartFile;

Just to note that I have annotated the SignatureRequest with @ApiModel

No RepliesBe the first to reply