Tuning up path -> component -> path tooling

This commit is contained in:
quobix
2024-06-13 08:07:47 -04:00
parent d48f6bd1ae
commit f33aa2fee0
4 changed files with 103 additions and 22 deletions

View File

@@ -430,7 +430,12 @@ func (index *SpecIndex) ExtractRefs(node, parent *yaml.Node, seenPath []string,
if i%2 == 0 && n.Value != "$ref" && n.Value != "" {
loc := append(seenPath, n.Value)
v := n.Value
if strings.HasPrefix(v, "/") {
v = strings.Replace(v, "/", "~1", 1)
}
loc := append(seenPath, v)
definitionPath := fmt.Sprintf("#/%s", strings.Join(loc, "/"))
_, jsonPath := utils.ConvertComponentIdIntoFriendlyPathSearch(definitionPath)