Path as a function
Opened this issue · 1 comments
pedrolaranjeiro commented
Hi
I use a function to get the base name for the route. When generating the open API.yaml, the function name is included in the path instead of the function's result.
@GenerateOpenApi
fun Application.configureRouting() {
routing {
route(getBaseRoute()) {
fun getBaseRoute(): String {
val version = Config.version.split(".")[0]
return "/api/v$version"
}
And I expect
Is this something you can fix?
Thank you for this plugin. It is exactly what I was looking for.
tabilzad commented
Unfortunately, this wouldn't really be possible per kotlin compiler design. The plugin can only evaluate compile time constants but not expressions. There is hope that kotlin would potentially support constant expressions so we could evaluate the literal output at compile time but as of now we are limited to constants only.