jooby icon indicating copy to clipboard operation
jooby copied to clipboard

[kotlin, openapi] Kooby extension method in another compilation unit

Open zzj37 opened this issue 2 years ago • 0 comments

The following code will generate valid openapi json file:

// an extension method that creates some routes
fun Kooby.helloRoute() {
    get("/hello") { "world" }
}

fun main(args: Array<String>) {
    runApp(args) {
        // calling the extension method
        helloRoute()
    }
}

as long as Kooby.helloRoute() method is written in the same compilation unit as main() in App.kt.

If I move Kooby.helloRoute() to another file, the generated openapi json will contain an empty paths section, although browsing to http://localhost:8080/hello still gets world.

zzj37 avatar Nov 06 '23 09:11 zzj37