Closed ihaydinn closed 1 year ago
Hi, it's hard to tell whats going on without some more information. Could you mabye provide some code and/or a description of what you did and already tried ?
Hello again. I want to add swagger document for ktor. I added the smiley4 swagger library to my ktor project by following the steps in the readme section. When I did run, only a document like the one I added above came up. No sample documentation for response or request body. Should I follow a different path?
My route example like this.
fun Application.ledgerRoute(repository: LedgerRepository) {
routing {
authenticate {
post("ledger") {
val principal = call.principal<UserIdPrincipalForUser>()
val model = call.receive<LedgerRequestModel>()
val result = repository.addTransaction(model.copy(userId = principal?.id.orZero))
call.respond(result)
}
}
}
}
and implementation
install(SwaggerUI) {
swagger {
swaggerUrl = "swagger-ui"
forwardRoot = true
}
info {
title = "Example API"
version = "latest"
description = "Example API for testing and demonstration purposes."
}
server {
url = "http://localhost:8080"
description = "Development Server"
}
}
maven ( url = "https://jitpack.io" )
implementation("io.github.smiley4:ktor-swagger-ui:1.4.0")
yes, exactly this. thank you
When i launch the application, the swagger file created but did not show response and request body models