We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I didn't catch if this issue has a solution or if it depends on the standard swagger-ui. There's one of the test cases: https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app119/HelloController.java that does not work when invoked from the UI.
The error reported in the console is:
Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]
Is it possible to annotate a mulitpart post request in a way that it allows to submit both a json payload and one or more files from the swagger-ui?
The text was updated successfully, but these errors were encountered:
@blaluc,
The only workaround for sending mutlipart data json and more files, are explained here:
Sorry, something went wrong.
The workaround from #820 still leaves Swagger UI in a broken state.
A working workaround for Swagger is to provide a custom HttpMessageConverter to deserialize application/octet-stream as shown here: #6462.
HttpMessageConverter
application/octet-stream
The converter:
@Bean public MappingJackson2HttpMessageConverter octetStreamJsonConverter() { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); converter.setSupportedMediaTypes(List.of(new MediaType("application", "octet-stream"))); return converter; }
The endpoint code should look like in the snippet below:
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity<Void> saveDocu2ment( @RequestPart PersonDTO personDTO, @RequestPart(value = "file") MultipartFile file ) { … }
Thanks to that you get a proper OpenAPI specification and working Swagger UI (tested with Spring Boot 2.5.6, Springdoc 1.6.6).
This should also work for #820 and #964.
No branches or pull requests
I didn't catch if this issue has a solution or if it depends on the standard swagger-ui.
There's one of the test cases:
https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app119/HelloController.java
that does not work when invoked from the UI.
The error reported in the console is:
Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]
Is it possible to annotate a mulitpart post request in a way that it allows to submit both a json payload and one or more files from the swagger-ui?
The text was updated successfully, but these errors were encountered: