Validate makes sure the service is valid.
()
| 97 | |
| 98 | // Validate makes sure the service is valid. |
| 99 | func (svc *GRPCServiceExpr) Validate() error { |
| 100 | verr := new(eval.ValidationErrors) |
| 101 | // Validate errors |
| 102 | for _, er := range svc.GRPCErrors { |
| 103 | verr.Merge(er.Validate()) |
| 104 | } |
| 105 | for _, er := range Root.API.GRPC.Errors { |
| 106 | // This may result in the same error being validated multiple |
| 107 | // times however service is the top level expression being |
| 108 | // walked and errors cannot be walked until all expressions have |
| 109 | // run. Another solution could be to append a new dynamically |
| 110 | // generated root that the eval engine would process after. Keep |
| 111 | // things simple for now. |
| 112 | verr.Merge(er.Validate()) |
| 113 | } |
| 114 | return verr |
| 115 | } |