Skip to content

How to have a root path on a huma group #757

@bbedward

Description

@bbedward

I have a huma group like:

teamsGroup := huma.NewGroup(api, "/teams")
teamsGroup.UseModifier(func(op *huma.Operation, next func(*huma.Operation)) {
	op.Tags = []string{"Teams"}
	next(op)
})
teamHandlers := teams_handler.NewHandlerGroup(srvImpl)
huma.Register(
	teamsGroup,
	huma.Operation{
		OperationID: "list-teams",
		Summary:     "List Teams",
		Description: "List all teams the current user is a member of",
		Path:        "/",
		Method:      http.MethodGet,
	},
	teamHandlers.ListTeams,
)

This generates a route like /teams/, but I would prefer it to generate the route /teams

Is this possible with any path syntax? When path is blank there is a panic at startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions