Validate validates the server and server hosts.
()
| 57 | |
| 58 | // Validate validates the server and server hosts. |
| 59 | func (s *ServerExpr) Validate() error { |
| 60 | verr := new(eval.ValidationErrors) |
| 61 | for _, h := range s.Hosts { |
| 62 | var verrs *eval.ValidationErrors |
| 63 | if errors.As(h.Validate(), &verrs) { |
| 64 | verr.Merge(verrs) |
| 65 | } |
| 66 | } |
| 67 | for _, svc := range s.Services { |
| 68 | if Root.Service(svc) == nil { |
| 69 | verr.Add(s, "service %q undefined", svc) |
| 70 | } |
| 71 | } |
| 72 | return verr |
| 73 | } |
| 74 | |
| 75 | // Finalize initializes the server services and/or host with default values if |
| 76 | // not set explicitly in the design. |