MCPcopy Create free account
hub / github.com/github/gh-aw / additionalPropertyNamesFor

Function additionalPropertyNamesFor

pkg/parser/json_path_locator.go:109–124  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
109func 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
126func findPathInYAMLLines(yamlContent string, pathSegments []PathSegment) JSONPathLocation {
127 lines := strings.Split(yamlContent, "\n")

Callers 1

Calls 1

Tested by

no test coverage detected