()
| 144 | } |
| 145 | |
| 146 | func (r SyncRequest) Validate() error { |
| 147 | if r.Source.URL == "" { |
| 148 | return errors.New("source URL is required") |
| 149 | } |
| 150 | if r.Target.URL == "" { |
| 151 | return errors.New("target URL is required") |
| 152 | } |
| 153 | if err := validateOperationMode(r.Policy.Mode); err != nil { |
| 154 | return err |
| 155 | } |
| 156 | if err := r.Policy.Validate(); err != nil { |
| 157 | return err |
| 158 | } |
| 159 | if _, err := validation.NormalizeProtocolMode(string(r.Policy.Protocol)); err != nil { |
| 160 | return fmt.Errorf("normalize protocol: %w", err) |
| 161 | } |
| 162 | if _, err := validation.ValidateMappings(validationMappings(r.Scope.Mappings), r.Scope.AllRefs); err != nil { |
| 163 | return fmt.Errorf("validate mappings: %w", err) |
| 164 | } |
| 165 | return nil |
| 166 | } |
| 167 | |
| 168 | func (r PlanRequest) Validate() error { |
| 169 | if r.Source.URL == "" { |
no test coverage detected