From eabf83ccbf70f6debbf15b514da0389e0007791f Mon Sep 17 00:00:00 2001 From: quobix Date: Sat, 20 Apr 2024 14:21:55 -0400 Subject: [PATCH] Rresolved issue https://github.com/daveshanley/vacuum/issues/481 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore array values defined as ‘$ref’ they are invalid to lookup. --- index/extract_refs.go | 4 ++++ index/resolver.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/index/extract_refs.go b/index/extract_refs.go index ba8477ea..0ede27b2 100644 --- a/index/extract_refs.go +++ b/index/extract_refs.go @@ -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 diff --git a/index/resolver.go b/index/resolver.go index 04afc842..022d80cf 100644 --- a/index/resolver.go +++ b/index/resolver.go @@ -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, "\\\\", "\\")