Reputation: 7775
There is an endpoint with request body of type MULTIPART-FORM-DATA
, with three fields:
required
field of type File
required
field of any type (File
or Text
)optional
field of type Text
What is a proper way to describe this request body in Springdoc (or Swagger v3) using java annotations?
I supposed that @Operation
is eligible for this, but cannot find any appropriate way to use it.
io.swagger.core.v3 - version 2.1.3
Upvotes: 3
Views: 7195
Reputation: 4769
Here a sample working code:
@PostMapping(value = "/upload2", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public String upload2(@RequestPart("my-attachment") MultipartFile myAttachment, @RequestPart("options") options options, Optional<Text> note) {
return "Ok";
}
Upvotes: 3