mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 20:47:49 +00:00
Building out extraction and location code.
adding tests to extactraction functions. Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"gopkg.in/yaml.v3"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func FindItemInMap[T any](item string, collection map[KeyReference[string]]ValueReference[T]) *ValueReference[T] {
|
||||
@@ -23,8 +22,6 @@ func FindItemInMap[T any](item string, collection map[KeyReference[string]]Value
|
||||
return nil
|
||||
}
|
||||
|
||||
var mapLock sync.Mutex
|
||||
|
||||
func LocateRefNode(root *yaml.Node, idx *index.SpecIndex) *yaml.Node {
|
||||
if rf, _, rv := utils.IsNodeRefValue(root); rf {
|
||||
// run through everything and return as soon as we find a match.
|
||||
@@ -80,7 +77,8 @@ func LocateRefNode(root *yaml.Node, idx *index.SpecIndex) *yaml.Node {
|
||||
cleaned := strings.ReplaceAll(rv, "#/paths/", "")
|
||||
cleaned = strings.ReplaceAll(cleaned, "/", ".")
|
||||
cleaned = strings.ReplaceAll(cleaned, "~1", "/")
|
||||
path, err := yamlpath.NewPath(fmt.Sprintf("$.paths.%s", cleaned))
|
||||
yamlPath := fmt.Sprintf("$.paths.%s", cleaned)
|
||||
path, err := yamlpath.NewPath(yamlPath)
|
||||
if err == nil {
|
||||
nodes, fErr := path.Find(idx.GetRootNode())
|
||||
if fErr == nil {
|
||||
|
||||
Reference in New Issue
Block a user