The depth was being artificially inflated with highly complex recursive designs, this fixes the depth counter permanently.

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2024-02-21 07:43:49 -05:00
parent 04f5514fa0
commit 40b16b3f76

View File

@@ -498,16 +498,15 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
if utils.IsNodeMap(n) || utils.IsNodeArray(n) { if utils.IsNodeMap(n) || utils.IsNodeArray(n) {
depth++ depth++
//refIsRef, _, _ := utils.IsNodeRefValue(ref.Node)
var foundRef *Reference var foundRef *Reference
//if refIsRef {
foundRef, _ = resolver.specIndex.SearchIndexForReferenceByReference(ref) foundRef, _ = resolver.specIndex.SearchIndexForReferenceByReference(ref)
if foundRef != nil && !foundRef.Circular { if foundRef != nil && !foundRef.Circular {
found = append(found, resolver.extractRelatives(foundRef, n, node, foundRelatives, journey, seen, resolve, depth)...) found = append(found, resolver.extractRelatives(foundRef, n, node, foundRelatives, journey, seen, resolve, depth)...)
depth--
} }
// }
if foundRef == nil { if foundRef == nil {
found = append(found, resolver.extractRelatives(ref, n, node, foundRelatives, journey, seen, resolve, depth)...) found = append(found, resolver.extractRelatives(ref, n, node, foundRelatives, journey, seen, resolve, depth)...)
depth--
} }
} }