Finalize makes sure that the API name is initialized and there is at least one server definition (if none exists, it creates a default server). If API name is empty, it sets the name of the first service definition as API name.
()
| 175 | // one server definition (if none exists, it creates a default server). If API |
| 176 | // name is empty, it sets the name of the first service definition as API name. |
| 177 | func (a *APIExpr) Finalize() { |
| 178 | if a.Name == "" { |
| 179 | a.Name = "api" |
| 180 | if len(Root.Services) > 0 { |
| 181 | a.Name = Root.Services[0].Name |
| 182 | } |
| 183 | } |
| 184 | if len(a.Servers) == 0 { |
| 185 | a.Servers = []*ServerExpr{a.DefaultServer()} |
| 186 | } |
| 187 | if a.Version == "" { |
| 188 | a.Version = "0.0.1" |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | // EvalName is the qualified name of the expression. |
| 193 | func (l *LicenseExpr) EvalName() string { return "License " + l.Name } |
nothing calls this directly
no test coverage detected