Skip to content

Commit

Permalink
Rresolved issue daveshanley/vacuum#481
Browse files Browse the repository at this point in the history
Ignore array values defined as ‘$ref’ they are invalid to lookup.
  • Loading branch information
daveshanley committed Apr 20, 2024
1 parent b4b24a0 commit eabf83c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index/extract_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ func (index *SpecIndex) ExtractRefs(node, parent *yaml.Node, seenPath []string,
if !utils.IsNodeStringValue(node.Content[i+1]) {
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
Expand Down
5 changes: 5 additions & 0 deletions index/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,11 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
if !utils.IsNodeStringValue(node.Content[i+1]) {
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 = strings.ReplaceAll(value, "\\\\", "\\")
Expand Down

0 comments on commit eabf83c

Please sign in to comment.