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

Function buildComponents

http/codegen/openapi/v3/builder.go:94–114  ·  view source on GitHub ↗

buildComponents builds the OpenAPI Components object.

(root *expr.RootExpr, types map[string]*openapi.Schema)

Source from the content-addressed store, hash-verified

92
93// buildComponents builds the OpenAPI Components object.
94func buildComponents(root *expr.RootExpr, types map[string]*openapi.Schema) *Components {
95 var schemesRef map[string]*SecuritySchemeRef
96 {
97 schemesRef = make(map[string]*SecuritySchemeRef)
98 for _, s := range root.API.HTTP.Services {
99 for _, e := range s.HTTPEndpoints {
100 for _, r := range e.Requirements {
101 for _, sch := range r.Schemes {
102 schemesRef[sch.Hash()] = &SecuritySchemeRef{
103 Value: buildSecurityScheme(sch),
104 }
105 }
106 }
107 }
108 }
109 }
110 return &Components{
111 SecuritySchemes: schemesRef,
112 Schemas: types,
113 }
114}
115
116// buildPaths builds the OpenAPI Paths map with key as the HTTP path string and
117// the value as the corresponding PathItem object.

Callers 1

NewFunction · 0.85

Calls 2

buildSecuritySchemeFunction · 0.85
HashMethod · 0.65

Tested by

no test coverage detected