MCPcopy Create free account
hub / github.com/goadesign/goa / addScopeDescription

Function addScopeDescription

http/codegen/openapi/v2/builder.go:125–139  ·  view source on GitHub ↗

addScopeDescription generates and adds required scopes to the scheme's description.

(scopes []*expr.ScopeExpr, sd *SecurityDefinition)

Source from the content-addressed store, hash-verified

123
124// addScopeDescription generates and adds required scopes to the scheme's description.
125func addScopeDescription(scopes []*expr.ScopeExpr, sd *SecurityDefinition) {
126 // Generate scopes to add to description
127 lines := make([]string, 0, len(scopes))
128
129 for _, scope := range scopes {
130 lines = append(lines, fmt.Sprintf(" * `%s`: %s", scope.Name, scope.Description))
131 }
132 // Add scope description only if scopes are defined
133 if len(lines) > 0 {
134 if sd.Description != "" {
135 sd.Description += "\n"
136 }
137 sd.Description += fmt.Sprintf("\n**Security Scopes**:\n%s", strings.Join(lines, "\n"))
138 }
139}
140
141// securitySpecFromExpr generates the OpenAPI security definitions from the
142// security design.

Callers 1

securitySpecFromExprFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected