Skip to content

Commit

Permalink
Makes overrideDescription private in BaseRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Dec 14, 2024
1 parent 260d2c6 commit 6450888
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ type BaseRoute struct {
Middlewares []func(http.Handler) http.Handler
AcceptedContentTypes []string // Content types accepted for the request body. If nil, all content types (*/*) are accepted.
Hidden bool // If true, the route will not be documented in the OpenAPI spec
OverrideDescription bool // Override the default description
DefaultStatusCode int // Default status code for the response
OpenAPI *OpenAPI // Ref to the whole OpenAPI spec

overrideDescription bool // Override the default description
}

func (r *BaseRoute) GenerateDefaultDescription(otherMiddlewares ...func(http.Handler) http.Handler) {
if r.OverrideDescription {
if r.overrideDescription {
return
}
r.Operation.Description = DefaultDescription(r.FullName, append(r.Middlewares, otherMiddlewares...)) + r.Operation.Description
Expand Down
6 changes: 3 additions & 3 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,12 @@ func OptionAddDescription(description string) func(*BaseRoute) {
}
}

// OptionOverrideDescription overrides the default description set by Fuego.
// By default, the description is set by Fuego with some info,
// OptionOverrideDescription overrides the default description set by Fuego.
// By default, the description is set by Fuego with some info,
// like the controller function name and the package name.
func OptionOverrideDescription(description string) func(*BaseRoute) {
return func(r *BaseRoute) {
r.OverrideDescription = true
r.overrideDescription = true
r.Operation.Description = description
}
}
Expand Down

0 comments on commit 6450888

Please sign in to comment.