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
type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, args interface{}) (interface{}, error)
type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc
Types are generated with the api and are part of the package of the api.
This makes it very difficult to reuse a middleware
I would suggest to add them to a part of the library and reuse them as part of the generated code.
PR #1021 (commit 844e5db) extracted the strict middleware types to runtime/strictmiddleware/* packages to address this issue. However, commit 5b562c4 (by the maintainer) deliberately reversed that approach, inlining the types back into each generated package and closing issue #2270. This is an explicit design decision: types are local per-package. A generic-based workaround exists (described in the issue comments). The issue is superseded by the intentional wontfix choice.
Activity
johanneswuerbach commentedon Feb 6, 2023
After testing different options, the following workaround seems to work:
and used using:
Not pretty, but it works :-)
mromaszewicz commentedon May 1, 2026
PR #1021 (commit 844e5db) extracted the strict middleware types to runtime/strictmiddleware/* packages to address this issue. However, commit 5b562c4 (by the maintainer) deliberately reversed that approach, inlining the types back into each generated package and closing issue #2270. This is an explicit design decision: types are local per-package. A generic-based workaround exists (described in the issue comments). The issue is superseded by the intentional wontfix choice.
Closing — not planned.