Doesn't support @RequestPart CustomObject in Spring Boot
See original GitHub issuePlease take the time to search the repository, if your question has already been asked or answered.
- What version of the library are you using?
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/>
</parent>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
What kind of issue is this?
- Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests or
steps to reproduce get fixed faster. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
- spring xml/java config that is relevant
- springfox specific configuration if it makes sense
- include any output you’ve received; logs, json snippets etc.; and what the expected output should be
- if you have a repo that demonstrates the issue for bonus points! See this example
Please do consider starring this repository if you do like this project and find it useful.
Please take a look at this api which is automatically converted to a form data with 3 properties:
- InteractionQuestionRequest request
- MultipartFile question-image
- MultipartFile winner-image
@PostMapping(value = ServicePath.QUESTIONS)
public ResponseEntity<RestResult<InteractionQuestionDTO>> createQuestion(
@RequestPart(name = "request") InteractionQuestionRequest request,
@RequestPart(name = "question-image", required = false) MultipartFile questionImage,
@RequestPart(name = "winner-image", required = false) MultipartFile winnerImage) {
RestResult<InteractionQuestionDTO> result = new RestResult<>();
result.setData(interactionService.createQuestion(request, questionImage, winnerImage));
result.setStatus(RestResult.STATUS_SUCCESS);
result.setMessage(resourceBundle.getMessage("msg.data.get.success"));
return new ResponseEntity<>(result, HttpStatus.OK);
}
Springfox swagger successfully display the MultipartFile with no error but any other objects seems to not be parsed into swagger. Example:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Spring MVC: Complex object as GET @RequestParam
I have request params as such: page-number and page-size . How will my request DTO object look like? In java, I can't create...
Read more >How to bind @RequestParam to object in Spring - Dev in Web
There's no easy way to magically bind HTTP arguments to a POJO using a parameterized constructor. The non-argument constructor is inevitable.
Read more >Spring @RequestParam Annotation - Baeldung
In this quick tutorial, we'll explore Spring's @RequestParam annotation and its attributes. Simply put, we can use @RequestParam to extract ...
Read more >Spring Boot request parameters validation - Wim Deblauwe
Use the org.springframework.validation.annotation.Validated annotation on the class level. (NOTE: javax.validation.Valid would not work here!)
Read more >Web on Reactive Stack - Spring
Spring WebFlux does not have built-in support to start or stop a server. However, it is easy to assemble an application from Spring ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is my config:
If I construct my Docket with DocumentationType.OAS_30 instead of DocumentationType.SWAGGER_2, then it works.