mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
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:
@@ -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
|
||||
|
||||
@@ -149,10 +149,10 @@ func (index *SpecIndex) SearchIndexForReferenceByReferenceWithContext(ctx contex
|
||||
Definition: n,
|
||||
IsRemote: true,
|
||||
RemoteLocation: n,
|
||||
Index: index,
|
||||
Index: rFile.GetIndex(),
|
||||
Node: node.Content[0],
|
||||
ParentNode: node,
|
||||
}, index, ctx
|
||||
}, rFile.GetIndex(), ctx
|
||||
} else {
|
||||
return nil, index, ctx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user