# ktor

Ryan Brink

05/07/2022, 2:31 AM
Hey 👋 I’m just beginning work on exploring migrating 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

Brent Beardsley

05/07/2022, 12:04 PM
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)

Ryan Brink

05/07/2022, 2:25 PM
Oh interesting… so attribute keys work across any event hook, not just the call related ones? I’ll have to try that out

Aleksei Tirman [JB]

05/08/2022, 8:29 AM
You can store your data in the application’s attributes that is accessible via
in the context of a route’s handler.