mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 04:20:17 +00:00
more ye olde time coverage for ye tests.
This commit is contained in:
@@ -89,16 +89,8 @@ func (ex *Example) Build(ctx context.Context, keyNode, root *yaml.Node, _ *index
|
|||||||
expChildNodes := low.ExtractNodesRecursive(ctx, vn)
|
expChildNodes := low.ExtractNodesRecursive(ctx, vn)
|
||||||
expChildNodes.Range(func(k, v interface{}) bool {
|
expChildNodes.Range(func(k, v interface{}) bool {
|
||||||
if arr, ko := v.([]*yaml.Node); ko {
|
if arr, ko := v.([]*yaml.Node); ko {
|
||||||
if ext, ok := ex.Nodes.Load(k); ok {
|
|
||||||
if extArr, kk := ext.([]*yaml.Node); kk {
|
|
||||||
ex.Nodes.Store(k, append(extArr, arr...))
|
|
||||||
} else {
|
|
||||||
ex.Nodes.Store(k, arr)
|
ex.Nodes.Store(k, arr)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ex.Nodes.Store(k, arr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -727,9 +727,6 @@ func (s *Schema) Build(ctx context.Context, root *yaml.Node, idx *index.SpecInde
|
|||||||
discriminator.AddNode(key.(int), g)
|
discriminator.AddNode(key.(int), g)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if n, ok := val.(*yaml.Node); ok {
|
|
||||||
discriminator.AddNode(key.(int), n)
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,12 @@ variables:
|
|||||||
low.GenerateHashString(s.Value))
|
low.GenerateHashString(s.Value))
|
||||||
|
|
||||||
assert.Equal(t, 1, orderedmap.Len(n.GetExtensions()))
|
assert.Equal(t, 1, orderedmap.Len(n.GetExtensions()))
|
||||||
|
|
||||||
|
// check nodes on variables
|
||||||
|
for k := n.Variables.Value.First(); k != nil; k = k.Next() {
|
||||||
|
assert.NotNil(t, k.Value().Value.GetKeyNode())
|
||||||
|
assert.NotNil(t, k.Value().Value.GetRootNode())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServer_Build_NoVars(t *testing.T) {
|
func TestServer_Build_NoVars(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user