()
| 166 | } |
| 167 | |
| 168 | func (r PlanRequest) Validate() error { |
| 169 | if r.Source.URL == "" { |
| 170 | return errors.New("source URL is required") |
| 171 | } |
| 172 | if r.Target.URL == "" { |
| 173 | return errors.New("target URL is required") |
| 174 | } |
| 175 | if err := validateOperationMode(r.Policy.Mode); err != nil { |
| 176 | return err |
| 177 | } |
| 178 | if err := r.Policy.Validate(); err != nil { |
| 179 | return err |
| 180 | } |
| 181 | if _, err := validation.NormalizeProtocolMode(string(r.Policy.Protocol)); err != nil { |
| 182 | return fmt.Errorf("normalize protocol: %w", err) |
| 183 | } |
| 184 | if _, err := validation.ValidateMappings(validationMappings(r.Scope.Mappings), r.Scope.AllRefs); err != nil { |
| 185 | return fmt.Errorf("validate mappings: %w", err) |
| 186 | } |
| 187 | return nil |
| 188 | } |
| 189 | |
| 190 | func (r ProbeRequest) Validate() error { |
| 191 | if r.Source.URL == "" { |
nothing calls this directly
no test coverage detected