additionalPropertyNamesFor returns the disallowed property names for a JSONPathInfo. It checks ErrorKind first (structural, no string parsing) and falls back to regex on Message.
(info JSONPathInfo)
| 107 | // additionalPropertyNamesFor returns the disallowed property names for a JSONPathInfo. |
| 108 | // It checks ErrorKind first (structural, no string parsing) and falls back to regex on Message. |
| 109 | func additionalPropertyNamesFor(info JSONPathInfo) []string { |
| 110 | if info.ErrorKind != nil { |
| 111 | if ap, ok := info.ErrorKind.(*kind.AdditionalProperties); ok { |
| 112 | return ap.Properties |
| 113 | } |
| 114 | switch info.ErrorKind.(type) { |
| 115 | case *kind.OneOf, *kind.AnyOf, *kind.AllOf, *kind.Group: |
| 116 | // Composite errors may wrap an additional-properties leaf; regex fallback |
| 117 | // preserves the historical location behavior for these aggregate kinds. |
| 118 | return extractAdditionalPropertyNames(info.Message) |
| 119 | default: |
| 120 | return nil |
| 121 | } |
| 122 | } |
| 123 | return extractAdditionalPropertyNames(info.Message) |
| 124 | } |
| 125 | |
| 126 | func findPathInYAMLLines(yamlContent string, pathSegments []PathSegment) JSONPathLocation { |
| 127 | lines := strings.Split(yamlContent, "\n") |
no test coverage detected