Skip to content

fix: override group modifier #819

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fourcels
Copy link
Contributor

@fourcels fourcels commented May 8, 2025

	grp := huma.NewGroup(api, "/users")
	grp.UseSimpleModifier(func(o *huma.Operation) {
		o.Summary = "User Summary"
	})

	// Register the router here
	huma.Get(grp, "/current", h.GetCurrent, func(o *huma.Operation) {
		o.Summary = "Current User"
	})

Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.09%. Comparing base (eb497ee) to head (711c20c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #819   +/-   ##
=======================================
  Coverage   93.08%   93.09%           
=======================================
  Files          23       23           
  Lines        5307     5312    +5     
=======================================
+ Hits         4940     4945    +5     
  Misses        314      314           
  Partials       53       53           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

oh(&operation)
if grp, ok := api.(*Group); ok {
for _, oh := range operationHandlers {
grp.UseSimpleModifier(oh)
Copy link
Owner

@danielgtaylor danielgtaylor May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this modify the group for all the other operations that may get registered on it as well? I'm not sure this is the correct behavior.

@fourcels what bug are you trying to fix with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

router modifier should overrite group modifier

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.

2 participants