mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 04:20:24 +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 {
|
if schNode != nil {
|
||||||
h := false
|
h := false
|
||||||
if h, _, refLocation = utils.IsNodeRefValue(schNode); h {
|
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)
|
ref, _, _, nCtx := low.LocateRefNodeWithContext(ctx, schNode, idx)
|
||||||
if ref != nil {
|
if ref != nil {
|
||||||
refNode = schNode
|
refNode = schNode
|
||||||
|
|||||||
@@ -149,10 +149,10 @@ func (index *SpecIndex) SearchIndexForReferenceByReferenceWithContext(ctx contex
|
|||||||
Definition: n,
|
Definition: n,
|
||||||
IsRemote: true,
|
IsRemote: true,
|
||||||
RemoteLocation: n,
|
RemoteLocation: n,
|
||||||
Index: index,
|
Index: rFile.GetIndex(),
|
||||||
Node: node.Content[0],
|
Node: node.Content[0],
|
||||||
ParentNode: node,
|
ParentNode: node,
|
||||||
}, index, ctx
|
}, rFile.GetIndex(), ctx
|
||||||
} else {
|
} else {
|
||||||
return nil, index, ctx
|
return nil, index, ctx
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user