I have a huge @OpenApi
annotation (basically it's documentation of a Javalin/Kotlin endpoint) which occupies a lot of lines:
@OpenApi(
summary = "",
description = "Lists all customers",
path = "customers",
queryParams =
// ...........
// ...........
// etc
)
override fun handle(context: Context) {
// body of the REST handler
}
I have to scroll a lot to see the actual handler. Hence, I'd like to isolate it somehow like:
@GetCustomersDoc
override fun handle(context: Context) {
// body of the REST handler
}
I'm OK with other solutions that make the documentation go elsewhere.
This would make the code cleaner and the docs segregated.
You could define separate Annotations:
annotation class MyOwnApi(
val openApi: OpenApi = OpenApi(
summary = "",
description = "Lists all customers",
path = "customers",
queryParams =
// ...........
// ...........
// etc
)
)
annotation class UserOpenApi(
val openApi: OpenApi = OpenApi(
summary = "Something",
description = "Lists all users",
// ...........
// ...........
// etc
)
)
Pros:
Cons:
@OpenApi
directly. In this case, you would need another reflective search to pull the annotation from a field!If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With