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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions huma.go
Original file line number Diff line number Diff line change
Expand Up @@ -2039,8 +2039,14 @@ func convenience[I, O any](api API, method, path string, handler func(context.Co
Path: path,
Metadata: map[string]any{},
}
for _, oh := range operationHandlers {
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

}
} else {
for _, oh := range operationHandlers {
oh(&operation)
}
}
// If not modified, hint that these were auto-generated!
if operation.OperationID == opID {
Expand Down