You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is (in its current form) a breaking proposal; so it should be targeted at v3.
Though there may be a way to introduce this without breakage.
The current middleware definition func(ctx huma.Context, next func(huma.Context)) receives the per-request ctx as well as the basically constant next parameter for each request. This makes it cumbersome to use middlewares that require "singleton" initialization (e.g. something using groupcache), because there's no way to access next on a per-registration basis.
I'd propose changing the definition of Middleware to:
Warning
This is (in its current form) a breaking proposal; so it should be targeted at v3.
Though there may be a way to introduce this without breakage.
The current middleware definition
func(ctx huma.Context, next func(huma.Context))receives the per-requestctxas well as the basically constantnextparameter for each request. This makes it cumbersome to use middlewares that require "singleton" initialization (e.g. something using groupcache), because there's no way to accessnexton a per-registration basis.I'd propose changing the definition of
Middlewareto:This would allow stuff like:
WDYT?