Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chi : Change the signature of the MiddlewareFunc for compatibilities. #578

Merged
merged 1 commit into from May 26, 2022

Conversation

uhey22e
Copy link
Contributor

@uhey22e uhey22e commented May 19, 2022

This PR changes the signature of the MiddlewareFunc for chi, and get more compatibility in the ecosystem.

Before:

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

Now:

type MiddlewareFunc func(http.Handler) http.Handler

Almost another famous middleware libraries for net/http in Go has a function signature below.

For example,

@uhey22e
Copy link
Contributor Author

uhey22e commented May 19, 2022

Related issue #286

As @deepmap-marcinr said, this PR breaks people's code.
But that's not a big deal, IMHO.

There is an easy work-around to fix the template version.
Following command runs oapi-codegen with version written in the go.mod file. So, developers can put breaking changes on ice for some time.

go run -mod=mod github.com/deepmap/oapi-codegen/cmd/oapi-codegen

@deepmap-marcinr deepmap-marcinr merged commit b027708 into deepmap:master May 26, 2022
namco1992 added a commit to namco1992/oapi-codegen that referenced this pull request Jun 30, 2023
This PR ported the fix deepmap#578
to gorilla/mux, so the gorilla/mux users can have a consistent behaviour
too.

Signed-off-by: Mengnan Gong <namco1992@gmail.com>
namco1992 added a commit to namco1992/oapi-codegen that referenced this pull request Aug 8, 2023
This PR ported the fix deepmap#578
to gorilla/mux, so the gorilla/mux users can have a consistent behaviour
too.

Signed-off-by: Mengnan Gong <namco1992@gmail.com>
namco1992 added a commit to namco1992/oapi-codegen that referenced this pull request Aug 8, 2023
This PR ported the fix deepmap#578
to gorilla/mux, so the gorilla/mux users can have a consistent behaviour
too.

Signed-off-by: Mengnan Gong <namco1992@gmail.com>
jamietanna pushed a commit that referenced this pull request Sep 2, 2023
This PR ported the fix #578
to gorilla/mux, so the gorilla/mux users can have a consistent behaviour
too.

Signed-off-by: Mengnan Gong <namco1992@gmail.com>
debuggerpk pushed a commit to breuHQ/oapi-codegen that referenced this pull request Sep 18, 2023
)

This PR ported the fix deepmap#578
to gorilla/mux, so the gorilla/mux users can have a consistent behaviour
too.

Signed-off-by: Mengnan Gong <namco1992@gmail.com>
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants