InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
8.76k stars 695 forks source link

Improve extendability (plugin support?) #1890

Open dshatz opened 3 weeks ago

dshatz commented 3 weeks ago

Is your feature request related to a problem? Please describe. I am developing a ksp processor for generating a koin module from ktorfit declarations. https://github.com/dshatz/ktorfit-koin

The user creates a class:

@ServiceModule(scan="com.example.services")
class NetworkModule

My library generates:

val NetworkModule.module: Module = networkModule
val networkModule = module {
   // all ktorfit services discovered by my ksp processor.
}

Then, import the generated module into a normal Koin module.

@Module(includes=[NetworkModule::class])
class AppModule

The problem is that koin config check doesn't allow this. The error I get is: Fix your configuration: add @Module annotation on <Module class generated by ktorfit-koin>

Describe the solution you'd like Optionally disable @Module annotation presence check. Or implement some plugin mechanism?

Describe alternatives you've considered Disabling koin config check.

Target Koin project