Fixed glitch reported by #219

Context was not being carried through correctly when resolving using `Schema()` and using exploded files.

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2023-12-18 09:37:39 -05:00
parent a912093804
commit 9cf06d3986

View File

@@ -463,9 +463,12 @@ func (s *Schema) Build(ctx context.Context, root *yaml.Node, idx *index.SpecInde
s.Reference = new(low.Reference) s.Reference = new(low.Reference)
s.Index = idx s.Index = idx
if h, _, _ := utils.IsNodeRefValue(root); h { if h, _, _ := utils.IsNodeRefValue(root); h {
ref, _, err := low.LocateRefNode(root, idx) ref, _, err, fctx := low.LocateRefNodeWithContext(ctx, root, idx)
if ref != nil { if ref != nil {
root = ref root = ref
if fctx != nil {
ctx = fctx
}
if err != nil { if err != nil {
if !idx.AllowCircularReferenceResolving() { if !idx.AllowCircularReferenceResolving() {
return fmt.Errorf("build schema failed: %s", err.Error()) return fmt.Errorf("build schema failed: %s", err.Error())