Skip to content

Commit

Permalink
Improving coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
daveshanley committed Aug 5, 2024
1 parent 63162c5 commit 2517c53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
16 changes: 2 additions & 14 deletions datamodel/low/base/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,7 @@ func (s *Schema) Build(ctx context.Context, root *yaml.Node, idx *index.SpecInde
// map to the local schema
expChildNodes.Range(func(k, v interface{}) bool {
if arr, ko := v.([]*yaml.Node); ko {
if ext, ok := s.Nodes.Load(k); ok {
if extArr, kk := ext.([]*yaml.Node); kk {
s.Nodes.Store(k, append(extArr, arr...))
} else {
s.Nodes.Store(k, arr)
}
} else {
if _, ok := s.Nodes.Load(k); !ok {
s.Nodes.Store(k, arr)
}
}
Expand All @@ -686,13 +680,7 @@ func (s *Schema) Build(ctx context.Context, root *yaml.Node, idx *index.SpecInde
// map to the local schema
expChildNodes.Range(func(k, v interface{}) bool {
if arr, ko := v.([]*yaml.Node); ko {
if ext, ok := s.Nodes.Load(k); ok {
if extArr, kk := ext.([]*yaml.Node); kk {
s.Nodes.Store(k, append(extArr, arr...))
} else {
s.Nodes.Store(k, arr)
}
} else {
if _, ok := s.Nodes.Load(k); !ok {
s.Nodes.Store(k, arr)
}
}
Expand Down
3 changes: 2 additions & 1 deletion datamodel/low/base/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,8 @@ func TestExtractSchema_CheckExampleNodesExtracted(t *testing.T) {
jong: jang
examples:
- tang: bang
- bom: jog`
- bom: jog
ding: dong`

var iNode yaml.Node
mErr := yaml.Unmarshal([]byte(yml), &iNode)
Expand Down

0 comments on commit 2517c53

Please sign in to comment.