buildInfo builds the OpenAPI Info object.
(api *expr.APIExpr)
| 63 | |
| 64 | // buildInfo builds the OpenAPI Info object. |
| 65 | func 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. |
| 94 | func buildComponents(root *expr.RootExpr, types map[string]*openapi.Schema) *Components { |