parseDocsFlattenCrawlArgs extracts the web-crawl source ("url") and its bounds (maxPages/maxDepth/sameHost), supporting both camelCase and kebab-case keys.
(raw map[string]json.RawMessage, out *docsFlattenArgs)
| 344 | // bounds (maxPages/maxDepth/sameHost), supporting both camelCase and |
| 345 | // kebab-case keys. |
| 346 | func parseDocsFlattenCrawlArgs(raw map[string]json.RawMessage, out *docsFlattenArgs) { |
| 347 | out.URL = jsonString(raw, "url", "seed") |
| 348 | if v, ok := raw["maxPages"]; ok && len(v) > 0 { |
| 349 | out.MaxPages = jsonInt(raw, "maxPages") |
| 350 | } else if _, ok := raw["max-pages"]; ok { |
| 351 | out.MaxPages = jsonInt(raw, "max-pages") |
| 352 | } |
| 353 | if v, ok := raw["maxDepth"]; ok && len(v) > 0 { |
| 354 | out.MaxDepth = jsonInt(raw, "maxDepth") |
| 355 | } else if _, ok := raw["max-depth"]; ok { |
| 356 | out.MaxDepth = jsonInt(raw, "max-depth") |
| 357 | } |
| 358 | if v, present := jsonBoolLookup(raw, "sameHost", "same-host"); present { |
| 359 | out.SameHost = v |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | // validateDocsFlattenSource enforces that exactly one of root|repo|url is set |
| 364 | // and sanity-checks the url source (scheme + non-negative bounds). |
no test coverage detected