Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zzj37 opened this issue Nov 6, 2023 · 0 comments
Open

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

zzj37 opened this issue Nov 6, 2023 · 0 comments

Comments

@zzj37
Copy link

zzj37 commented Nov 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants