Description
Describe the bug
While defining the controller as an abstraction and using generic as a response, the example and schema in the swagger are empty.
To Reproduce
I have generic controller to provide crud methods as follows:
abstract class BaseCrudController<T, E : BaseEntityModel>(private val baseCrudService: BaseCrudService<T, E>) {
...
@GetMapping("/{sid}")
open fun read(@PathVariable sid: String): Mono<ResponseEntity<T>> =
baseCrudService.read(sid)
.map { ResponseEntity.ok().body(it) }
.defaultIfEmpty(ResponseEntity.notFound().build())
...
}
and this is used in User controller implementation:
@RestController
@RequestMapping("api/import/user")
class UsrController(userService: UserService) :
BaseCrudController<User, UserEntity>(userService)
User class contains the definition of swagger schema:
data class User(
@get:Schema(
title = "Speaking Id of User",
pattern = Pattern.speakingId,
example = "newUser"
)
val sid: String
)
Expected behavior
I should see the example and schema. In version 1.4.4 it still not works.
Additional context
I found if I define result differently then it works:
Mono<ResponseEntity<T>>
-> Mono<T>
but in this case, I am losing the possibility to control response, I mean I have to control it differently (by exception handler).
Also if this controller is not defined as abstract the definition of endpoints are under a class with @RestController the
Mono<ResponseEntity<User>>
works like a charm.