<Swagger - Documenting Endpoints That Return Diffe...
# stackoverflow
u
Swagger - Documenting Endpoints That Return Different Structures Consider the following end-point: @ApiOperation( value = "Does some job.", response = SomeObject::class, responseContains = "Response" ) @PostMapping("/issue", consumes = [APPLICATION_JSON], produces = [APPLICATION_JSON]) fun issue(@RequestBody body: Message): ResponseEntity { ... } Let's assume that Message is modelled as such: data class Message(val greeting: String, val timeout: Long? = null) If we requested (using no timeout)... { "greeting": "Hello, World!" } We'd get...