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

Function buildInfo

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

buildInfo builds the OpenAPI Info object.

(api *expr.APIExpr)

Source from the content-addressed store, hash-verified

63
64// buildInfo builds the OpenAPI Info object.
65func buildInfo(api *expr.APIExpr) *Info {
66 title := api.Title
67 if title == "" {
68 title = "Goa API" // cannot be empty as per OpenAPI spec
69 }
70 info := &Info{
71 Title: title,
72 Description: api.Description,
73 TermsOfService: api.TermsOfService,
74 Version: api.Version,
75 Extensions: openapi.ExtensionsFromExpr(api.Meta),
76 }
77 if c := api.Contact; c != nil {
78 info.Contact = &Contact{
79 Name: c.Name,
80 Email: c.Email,
81 URL: c.URL,
82 }
83 }
84 if l := api.License; l != nil {
85 info.License = &License{
86 Name: l.Name,
87 URL: l.URL,
88 }
89 }
90 return info
91}
92
93// buildComponents builds the OpenAPI Components object.
94func buildComponents(root *expr.RootExpr, types map[string]*openapi.Schema) *Components {

Callers 2

TestBuildInfoFunction · 0.85
NewFunction · 0.85

Calls 1

ExtensionsFromExprFunction · 0.92

Tested by 1

TestBuildInfoFunction · 0.68