buildComponents builds the OpenAPI Components object.
(root *expr.RootExpr, types map[string]*openapi.Schema)
| 92 | |
| 93 | // buildComponents builds the OpenAPI Components object. |
| 94 | func 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. |
no test coverage detected