(raw string)
| 324 | } |
| 325 | |
| 326 | func validateAIProviderBaseURL(raw string) []ValidationError { |
| 327 | var validations []ValidationError |
| 328 | parsed, err := url.Parse(raw) |
| 329 | if err != nil || parsed.Scheme == "" || parsed.Host == "" { |
| 330 | validations = append(validations, ValidationError{ |
| 331 | Field: "base_url", |
| 332 | Detail: "base_url must be an absolute URL (e.g. https://api.example.com/)", |
| 333 | }) |
| 334 | return validations |
| 335 | } |
| 336 | if parsed.Scheme != "http" && parsed.Scheme != "https" { |
| 337 | validations = append(validations, ValidationError{ |
| 338 | Field: "base_url", |
| 339 | Detail: fmt.Sprintf("base_url scheme must be http or https, got %q", parsed.Scheme), |
| 340 | }) |
| 341 | } |
| 342 | return validations |
| 343 | } |
| 344 | |
| 345 | // validateAIProviderAPIKeys checks that each supplied key is non-empty |
| 346 | // and free of leading/trailing whitespace. An empty slice itself is |
no test coverage detected