stripAtPathPrefix removes "- at '/path': " or "at '/path': " prefixes from schema error lines and formats nested path references to be more readable. Examples: - "- at '/engine': value must be one of..." → "value must be one of..." - "- at '/permissions/deployments': value must be..." → "'deploymen
(line string)
| 236 | // - "- at '/engine': value must be one of..." → "value must be one of..." |
| 237 | // - "- at '/permissions/deployments': value must be..." → "'deployments': value must be..." |
| 238 | func stripAtPathPrefix(line string) string { |
| 239 | match := atPathPattern.FindStringSubmatch(line) |
| 240 | if match == nil { |
| 241 | return line |
| 242 | } |
| 243 | path := match[1] |
| 244 | msg := match[2] |
| 245 | |
| 246 | // For nested paths (e.g., /permissions/deployments), keep the last component |
| 247 | // so users know which sub-field has the error |
| 248 | if idx := strings.LastIndex(path, "/"); idx > 0 { |
| 249 | subField := path[idx+1:] |
| 250 | return fmt.Sprintf("'%s': %s", subField, msg) |
| 251 | } |
| 252 | |
| 253 | // For top-level field errors, just return the constraint message |
| 254 | return msg |
| 255 | } |
| 256 | |
| 257 | // findFrontmatterBounds finds the start and end indices of frontmatter in file lines |
| 258 | // Returns: startIdx (-1 if not found), endIdx (-1 if not found), frontmatterContent |
no outgoing calls