feat!: refactor middlewares to separate init from run#832
Open
costela wants to merge 2 commits intodanielgtaylor:mainfrom
Open
feat!: refactor middlewares to separate init from run#832costela wants to merge 2 commits intodanielgtaylor:mainfrom
costela wants to merge 2 commits intodanielgtaylor:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors how middleware functions are defined and executed in the huma API by separating initialization from runtime execution. The changes update the middleware function signatures across production and test files, ensuring that middleware now follows the pattern func(next) func(ctx) for improved composability.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| huma_test.go | Updated middleware function signature in tests |
| group_test.go | Updated middleware function signature in group tests |
| group.go | Adjusted UseMiddleware signature to use the Middleware type |
| chain.go | Refactored middleware chaining to call Middleware functions directly |
| api_test.go | Updated middleware usage pattern in API tests |
| api.go | Updated UseMiddleware signature in the API interface and implementation |
| adapters/humafiber/humafiber_context_test.go | Updated middleware signature in fiber adapter tests |
| adapters/adapters_test.go | Updated middleware signature in adapter tests |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #832 +/- ##
==========================================
- Coverage 93.08% 93.03% -0.05%
==========================================
Files 23 23
Lines 5307 5386 +79
==========================================
+ Hits 4940 5011 +71
- Misses 314 319 +5
- Partials 53 56 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a POC PR for #831. See the issue for more details.
Fixes #831