Fernando Sanchez (Perraco Labs)
06/02/2024, 10:47 AMpost<TestMessageRequest>
, like in the following example:
@Serializable
data class TestMessageRequest(val message: String, val status: Int)
fun Route.testMessageRoute() {
post<TestMessageRequest>("/message") { request ->
println(request)
call.respond(HttpStatusCode.OK)
}
}
The endpoint only gets included in the OpenAPI file if I remove <TestMessageRequest>
.
On the other hand, type objects are included in the file when the endpoints are instead get
calls returning them. It seems the issue affects only post
calls.Fernando Sanchez (Perraco Labs)
06/02/2024, 11:05 AMcall.receive
, then the documentation gets correctly generated. But the above syntax seems cleaner as it avoids having to write an extra line to receive the object.
So, is this a bug, or the intended behavior?
fun Route.testMessageRoute() {
post("/message") {
val request = call.receive<TestMessageRequest>()
println(request)
call.respond(HttpStatusCode.OK)
}
}
Aleksei Tirman [JB]
06/03/2024, 7:35 AM