Fixed issue reported in discord channel

Building out a model, the current position was getting a bit muddled with deeply nested file references.

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2024-02-12 10:38:37 -05:00
parent ca74e83a82
commit 974c7bbf49
2 changed files with 11 additions and 2 deletions

View File

@@ -1221,6 +1221,15 @@ func ExtractSchema(ctx context.Context, root *yaml.Node, idx *index.SpecIndex) (
if schNode != nil {
h := false
if h, _, refLocation = utils.IsNodeRefValue(schNode); h {
var specPath string
if ctx != nil && ctx.Value(index.CurrentPathKey) != nil {
specPath = ctx.Value(index.CurrentPathKey).(string)
}
if idx.GetSpecAbsolutePath() != specPath && (!strings.HasPrefix(refLocation, "http") &&
!strings.HasPrefix(idx.GetSpecAbsolutePath(), "http")) {
ctx = context.WithValue(ctx, index.CurrentPathKey, idx.GetSpecAbsolutePath())
}
ref, _, _, nCtx := low.LocateRefNodeWithContext(ctx, schNode, idx)
if ref != nil {
refNode = schNode