Jonas TM
03/09/2023, 12:33 PMOpenAPI
Swagger
Ktor provides plugins for OpenAPI and Swagger. However the documentation is quite limited. Is there currently any way to add information to the documentation like general API infos and single endpoint descriptions? Both plugins also seem to ignore the POST
body definitions, is this a known problem?e5l
03/09/2023, 12:34 PMVadim Briliantov
03/09/2023, 12:37 PMJonas TM
03/09/2023, 12:40 PMVadim Briliantov
03/09/2023, 12:43 PMJonas TM
03/09/2023, 12:43 PMJonas TM
03/09/2023, 12:43 PMJonas TM
03/09/2023, 12:45 PMVadim Briliantov
03/09/2023, 12:53 PMJonas TM
03/09/2023, 12:53 PMVadim Briliantov
03/09/2023, 12:55 PMVadim Briliantov
03/09/2023, 12:55 PMVadim Briliantov
03/09/2023, 12:56 PMJonas TM
03/09/2023, 2:18 PMVadim Briliantov
03/09/2023, 2:23 PMJonas TM
03/09/2023, 2:23 PMJonas TM
03/09/2023, 3:58 PMkdoc
is used to add more infos to an endpoint for the generated spec? I am struggling to get it working.
The IntelliJ page is unfortunately not giving any details here:
Documentation comments for a specific route are used as endpoint descriptions
Vadim Briliantov
03/09/2023, 4:34 PMVadim Briliantov
03/09/2023, 4:37 PMJonas TM
03/09/2023, 5:12 PMJonas TM
03/09/2023, 5:12 PMVadim Briliantov
03/09/2023, 11:28 PMJonas TM
03/10/2023, 11:00 AMdefault
section.
• We use the StatusPages
plugin to return a specific error object in case something goes wrong. Would it possible to include this in the spec generation? I am guessing this one is a bit more tricky to do automatically. Maybe some way to define possible errors responses in kdoc would be a simple solution.
install(StatusPages) {
exception<CustomApiException> { call, e ->
call.respond(e.statusCode, ErrorResp(e.message))
}
}
get("/test") {
throw CustomApiException("some error reason returned to caller")
}
Vadim Briliantov
03/12/2023, 9:36 PMIs there a way to define tags via kdocUnfortunately, at the moment there is no way to do this. But we are planning to support Tags as well at some point. I can’t tell you what would be the solution for this, but I hope we’ll come up with something nice 🙂
We use theYes!plugin to return a specific error object in case something goes wrong. Would it possible to include this in the spec generation?StatusPages
StatusPages
support is already implemented and will be also available in the upcoming IDE releases. Maybe it will become available a bit later than POST
bodies but anyway in the nearest futureJonas TM
03/13/2023, 8:57 AM