Closed
Description
Given a REST controller handler method like this (note how one parameter (stringParam
) is required, while the other (fileParam
) is not — as per the required
property of the @RequestPart
annotation):
@PostMapping("/foo", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
fun foo(
@RequestPart stringParam: String,
@RequestPart(required = false) fileParam: MultipartFile?
) {}
…SpringDoc produces an API definition that looks something like this (note how neither of the parameters are marked as required):
…
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"properties": {
"fileParam": {
"format": "binary",
"type": "string"
},
"stringParam": {
"type": "string"
}
},
"type": "object"
}
}
}
},
…
Expected: the multipart/form-data
schema object in the generated spec to include "required": ["stringParam"]
.
Using:
- Spring boot v. 2.4.2
springdoc-openapi-ui
v. 1.5.4springdoc-openapi-kotlin
v. 1.5.4