Skip to content

Commit

Permalink
Fixed off by one error
Browse files Browse the repository at this point in the history
Saw this blow up in the platform today. Silly me.
  • Loading branch information
daveshanley committed Sep 11, 2024
1 parent efe5523 commit 8e9d97c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions index/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"strings"

"github.com/pb33f/libopenapi/utils"
"slices"
"gopkg.in/yaml.v3"
"slices"
)

// ResolvingError represents an issue the resolver had trying to stitch the tree together.
Expand Down Expand Up @@ -521,7 +521,6 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
continue
}


value := node.Content[i+1].Value
value = strings.ReplaceAll(value, "\\\\", "\\")
var locatedRef *Reference
Expand Down Expand Up @@ -657,7 +656,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
n.Value == "anyOf" {

// 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
if k, v := utils.FindKeyNodeTop("items", node.Content[i+1].Content); v != nil {
if utils.IsNodeMap(v) {
Expand Down

0 comments on commit 8e9d97c

Please sign in to comment.