Fixed off by one error

Saw this blow up in the platform today. Silly me.
This commit is contained in:
quobix
2024-09-11 11:18:06 -04:00
parent efe5523222
commit 8e9d97c5d5

View File

@@ -11,8 +11,8 @@ import (
"strings" "strings"
"github.com/pb33f/libopenapi/utils" "github.com/pb33f/libopenapi/utils"
"slices"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"slices"
) )
// ResolvingError represents an issue the resolver had trying to stitch the tree together. // ResolvingError represents an issue the resolver had trying to stitch the tree together.
@@ -521,7 +521,6 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
continue continue
} }
value := node.Content[i+1].Value value := node.Content[i+1].Value
value = strings.ReplaceAll(value, "\\\\", "\\") value = strings.ReplaceAll(value, "\\\\", "\\")
var locatedRef *Reference var locatedRef *Reference
@@ -657,7 +656,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
n.Value == "anyOf" { n.Value == "anyOf" {
// if this is a polymorphic link, we want to follow it and see if it becomes circular // if this is a polymorphic link, we want to follow it and see if it becomes circular
if i+1 <= len(node.Content) && utils.IsNodeMap(node.Content[i+1]) { // check for nested items if i+1 < len(node.Content) && utils.IsNodeMap(node.Content[i+1]) { // check for nested items
// check if items is present, to indicate an array // check if items is present, to indicate an array
if k, v := utils.FindKeyNodeTop("items", node.Content[i+1].Content); v != nil { if k, v := utils.FindKeyNodeTop("items", node.Content[i+1].Content); v != nil {
if utils.IsNodeMap(v) { if utils.IsNodeMap(v) {