-
-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Description
I've got something like this:
internalApi := huma.NewGroup(api, "/internal")
requireUserAuthHandler := auth.CreateRequireUserAuthHandler(internalApi)
internalApi.UseSimpleModifier(func(op *huma.Operation) {
op.Tags = append(op.Tags, "Internal")
if _, noAuth := op.Metadata["NoUserAuth"]; !noAuth {
op.Security = append(op.Security, map[string][]string{"SessionCookie": {}})
op.Middlewares = append(op.Middlewares, auth.UserAuthHandler, requireUserAuthHandler)
op.Errors = append(op.Errors, http.StatusUnauthorized)
}
})
sessionApi := huma.NewGroup(internalApi, "/session")
// a bunch of calls to huma.Register(sessionApi, ...)
When I specify Errors
in the Operation
passed to huma.Register
, it's correctly defined in the OpenAPI document. But, it doesn't reflect the error codes updated by the simple modifier. The changes in the modifier to Middlewares
, Security
, and Tags
are reflected correctly by the OpenAPI document, only changes to Errors
are not reflected in the document.
Metadata
Metadata
Assignees
Labels
No labels