Hey :wave: I’m just beginning work on exploring mi...
# ktor
r
Hey 👋 I’m just beginning work on exploring migrating kompendium https://github.com/bkbnio/kompendium to Ktor 2… I am currently exploring the shiny new route level plugins and am wondering, is there any way to update application plugin state with information provided from a route level plugin? Should specify, I don’t want this to be call state, I see that you can use attribute keys to share data across the call stack. This would be state that is set at the application startup, essentially using the route level plugins to feed back into the application level open api spec, allowing you to compose the spec from the individual routes
b
I’m using attribute keys to do this. I created a swagger extension method on Route that adds the open api data to a list in attributes. Then in a later plugin I process that data into the open api spec
I'm using Resources (instead of Locations)
r
Oh interesting… so attribute keys work across any event hook, not just the call related ones? I’ll have to try that out
a
You can store your data in the application’s attributes that is accessible via
call.application.attributes
in the context of a route’s handler.