fix(group): ensure "Group" satisfies the configProvider interface#976
Conversation
Before this change, using Huma's route group feature would not propagate Huma's config to the group router and cause all routes attached to a group to use a default Huma config.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #976 +/- ##
=======================================
Coverage 93.11% 93.12%
=======================================
Files 23 23
Lines 4766 4768 +2
=======================================
+ Hits 4438 4440 +2
Misses 269 269
Partials 59 59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes a bug where route groups were not propagating Huma's configuration, causing all routes attached to a group to use default config values instead of the API's configured values.
Changes:
- Added
Config()method toGrouptype to implement theconfigProviderinterface - Added compile-time interface assertions to ensure
Group,api, andmapRegistryproperly implement their respective interfaces - Added test case to verify config propagation works correctly for grouped routes
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| group.go | Implemented Config() method for Group type and added interface assertions |
| api.go | Added compile-time interface assertions for api type |
| registry.go | Added compile-time interface assertions for mapRegistry type |
| huma_test.go | Added test to verify config propagation through groups |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Great catch! The tests should include group in their name, since currently they look the same as the normal tests. I like the interface implementation requirement, though there should be a comment with them so they're clear to everyone :) |
8f8aae2 to
f658a43
Compare
|
Updated, ptal :) |
Before this change, using Huma's route group feature would not propagate Huma's config to the group router and cause all routes attached to a group to use a default Huma config.