I have springboot(2.11.RELEASE) webflux application written using kotlin ('1.3.50'). I would like to add swagger documentation. I added to my build.gradle:
compile group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
my Rest controller looks like this:
@RestController
@RequestMapping("/path", produces = [MediaType.APPLICATION_JSON_VALUE])
@Validated
class CreditApplicationController @Autowired constructor(
private val creditService: CreditService
) {
@PostMapping(consumes = [MediaType.APPLICATION_JSON_VALUE], produces = [MediaType.APPLICATION_JSON_VALUE])
fun applyCredit(
@Valid @RequestBody request: ApplyCreditRequest,
@OperationId operationId: String
): Mono<ResponseEntity<ApplicationCreditResponse>> {
...
the ApplyCreditRequest is a simple kotlin data class
@Validated
data class ApplyCreditRequest(
@get:JsonProperty("application_id", required = true)
@NotBlank(message = "application_id cannot be empty")
val applicationId: String,
@get:JsonProperty("customer_info", required = true)
@field:Valid
val customerInfo: CustomerInfo,
@get:JsonProperty("credit_details", required = true)
@field:Valid
val creditDetails: CreditDetails,
@get:JsonProperty("agent", required = true)
@Valid
val agent: Agent
)
However when I go to the swagger generated page the request body is shown to be a string. How to make it show as a ApplyCreditRequest json I expect it to be ?

UPDATE:
Updated to:
@PostMapping(consumes = [MediaType.APPLICATION_JSON_VALUE], produces = [MediaType.APPLICATION_JSON_VALUE])
fun applyCredit(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
content = [
Content(
schema = Schema(
implementation = ApplyCreditRequest::class
)
)
]
) @Valid @RequestBody request: ApplyCreditRequest,
@OperationId operationId: String
): Mono<ResponseEntity<ApplicationCreditResponse>> {
and still doesn't work