Skip to content

Commit

Permalink
ignore empty json fields when processing templates
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Aug 3, 2016
1 parent 469def0 commit f5f3e28
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ func yamlFixup(data interface{}) (interface{}, error) {
return nil, err
}
}
if len(copy) == 0 {
return nil, nil
}
return copy, nil
case map[string]interface{}:
copy := make(map[string]interface{})
Expand All @@ -332,6 +335,9 @@ func yamlFixup(data interface{}) (interface{}, error) {
copy[k] = fixed
}
}
if len(copy) == 0 {
return nil, nil
}
return copy, nil
case []interface{}:
copy := make([]interface{}, 0, len(d))
Expand All @@ -342,6 +348,9 @@ func yamlFixup(data interface{}) (interface{}, error) {
copy = append(copy, fixed)
}
}
if len(copy) == 0 {
return nil, nil
}
return copy, nil
case string:
if d == "" || d == "\n" {
Expand Down

0 comments on commit f5f3e28

Please sign in to comment.