Ignore array values defined as ‘$ref’ they are invalid to lookup.
This commit is contained in:
quobix
2024-04-20 14:21:55 -04:00
parent b4b24a02f3
commit ac4b6ecd31
2 changed files with 9 additions and 0 deletions

View File

@@ -215,6 +215,10 @@ func (index *SpecIndex) ExtractRefs(node, parent *yaml.Node, seenPath []string,
if !utils.IsNodeStringValue(node.Content[i+1]) { if !utils.IsNodeStringValue(node.Content[i+1]) {
continue continue
} }
// issue #481, don't look at refs in arrays, the next node isn't the value.
if utils.IsNodeArray(node) {
continue
}
} }
index.linesWithRefs[n.Line] = true index.linesWithRefs[n.Line] = true

View File

@@ -516,6 +516,11 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
if !utils.IsNodeStringValue(node.Content[i+1]) { if !utils.IsNodeStringValue(node.Content[i+1]) {
continue continue
} }
// issue #481 cannot look at an array value, the next not is not the value!
if utils.IsNodeArray(node) {
continue
}
value := node.Content[i+1].Value value := node.Content[i+1].Value
value = strings.ReplaceAll(value, "\\\\", "\\") value = strings.ReplaceAll(value, "\\\\", "\\")