-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@RequestPart that are in the body aren't represented correctly #836
Comments
Looks like swagger-core doesn't support multipart-formData very well. This is a limitation with the swagger models so that it doesn't allow one to express request-parts to be expressed in as form bodys |
@RizziCR After a little bit of research here it seems like swagger-ui only supports the notion of form variables that are primitive types string, int etc. and not complex types that can be a It appears the swagger-core is doing the right thing by not exposing the schema in a FormParameter. While http spec allows you to specify content types in a multipart/form-data request, its not common and it doesn't appear that its supported by tools like Postman. So until someone can tell me any different, really changing it to this style is your best bet as far as this issue is concerned. @RequestMapping(value = "addContactWithFile", method = RequestMethod.POST)
@ApiOperation(value = "Add a new contact with file attachment")
public ResponseEntity<Void> addContactWithFile(@RequestPart String contactId, @RequestPart MultipartFile singleFile) {
log.debug(contactId); //<-- String variable
log.debug(singleFile.getName());
return new ResponseEntity<>(HttpStatus.OK);
} We can revisit this at a later point in time |
Closing this as its a very esoteric feature which has a work around. Feel free to reopen if required |
I'v got the same problem. This case is not esoteric (:-)). |
I think swagger-ui doesnt support this feature. Im happy to reopen it but I don't think it belongs in this project. it should be reported in swagger-ui |
Causes an incorrect output
Thanks for reporting @RizziCR!
The text was updated successfully, but these errors were encountered: