-
Notifications
You must be signed in to change notification settings - Fork 43
Extensions (WIP: needs more extensive hook system)
Wicpar edited this page Jan 13, 2020
·
1 revision
Extensions are a way to add custom behavior to the Ktor OpenAPI Generator
currently supported hooks (see interface OpenAPIGenExtension):
- onInit(OpenAPIGen)
feel free to request more hooks, we add them on an as needed basis.
// in this example we create an interface to automatically register new implemented global modules (See Modules)
// this interface is available in the library directly, no need to reimplement it
interface OpenAPIGenModuleExtension: OpenAPIModule, OpenAPIGenExtension {
override fun onInit(gen: OpenAPIGen) {
gen.globalModuleProvider.registerModule(this)
}
}
install(OpenAPIGen) {
...
scanPackagesForModules += "com.example.extensions"
}