Closed
Description
Describe the bug
- I try to make a simple request with multipart and JSON object but doesn't generate the right request.
An example of StackOverflow:
https://stackoverflow.com/a/25183266/4693765
To Reproduce
Steps to reproduce the behavior:
- Spring boot 2.2.5.RELEASE
- Spring doc 1.4.4
- Kotlin project with:
springdoc-openapi-ui
springdoc-openapi-data-rest
springdoc-openapi-security
springdoc-openapi-kotlin
Rest controller:
@PostMapping("test",consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
fun saveDocu2ment(@RequestPart(value = "file",required = true) file: MultipartFile,
@RequestPart(required = true) type:MailDto) {
}
Open Api JSON
"paths": {
"/api/v2/mail/test": {
"post": {
"tags": [
"mail-rest-controller-v-2"
],
"operationId": "saveDocu2ment",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary"
},
"type": {
"$ref": "#/components/schemas/MailDto"
}
}
Request when execute with swagger-ui:
curl -X POST "http://localhost:8080/api/v2/mail/test" -H "accept: */*" -H "Content-Type: multipart/form-data" -F "type={ "authorizationToken": "string", "to": [ "string" ], "sender": "string", "subject": "string", "bodyText": "string", "files": [ "string" ] }" -F "file=@img_payment_success.png;type=image/png"
Screenshots
Image of example request
Additional context
An error response of spring boot (oviusly error):
ERROR 3108 --- [nio-8080-exec-1] e.d.s.base.BaseAdviceRestController : Content type 'application/octet-stream' not supported
Metadata
Metadata
Assignees
Labels
No labels