I will return the following response object SageResponseBody<List<Long>>
.
data class SageResponseBody<T>(
val data: T
)
Then I tried to define this response object through annotations.
@ApiResponses(
value = [ApiResponse(
responseCode = "200",
description = "request success",
content = [Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = Schema(type = "object", properties = [StringToClassMapItem(List::class, key = "data")])
)]
)]
)
I can’t set List<Long>
and the response object defined is incorrect.
"responses": {
"200": {
"description": "request success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
}
}
}
}
I’m using swagger 2.x
. What is the correct approach?