Closed
Description
I have created controller with optional RequestBody. I added RequestBody but description not shown in the generated Swagger UI.
Controller snippet:
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.responses.ApiResponse
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
import java.util.UUID
@RestController
class HelloController {
@PostMapping("/hello")
@Operation(summary = "Say hello",
requestBody = io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "Map uid -> string)",
required = false
),
responses = [
ApiResponse(responseCode = "200", description = "Ok"),
])
fun hello(@RequestBody(required = false) body: Map<UUID, String>?): ResponseEntity<*> {
return ResponseEntity.ok().build<Any>()
}
}
Actual OpenAPI Description json:
hello":{"post":{"tags":["hello-controller"],"summary":"Say hello","operationId":"hello","requestBody":{"description":"Map uid -> string)"},"responses":{"200":{"description":"Ok","content":{"*/*":{"schema":{"type":"object"}}}}}}},
Expected behavior:
Request body shown
Actual behavior:
Request body not shown
Spring boot: 3.2.2
Spring doc: 2.6.0
Metadata
Metadata
Assignees
Labels
No labels