You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To setup the library in the ktor context, a few initial informations must be registered.
Minimal configuration
install(OpenAPIGen) {
// basic info
info {
version ="0.0.1"
title ="Test API"
description ="The Test API"
contact {
name ="Support"
email ="support@test.com"
}
}
// describe the server, add as many as you want
server("http://localhost:8080/") {
description ="Test server"
}
//optional
schemaNamer = {
//rename DTOs from java type name to generator compatible formval regex =Regex("[A-Za-z0-9_.]+")
it.toString().replace(regex) { it.value.split(".").last() }.replace(Regex(">|<|, "), "_")
}
}
// Content negociation is required
install(ContentNegotiation) {
jackson()
}
Routing
Enable routing in an Application or Routing context
apiRouting {
// declare routes here as you would in ktor, with specified types
}