Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
feat: allow blank value in documentQuery
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Davis <[email protected]>
  • Loading branch information
Jeff Davis authored and JefeDavis committed Jun 16, 2021
1 parent 8fe1a79 commit 4e5720f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions internal/overlays/documentquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,21 @@ func (dq DocumentQueries) checkQueries(node *yaml.Node) bool {
func (dq *DocumentQuery) checkQuery(node *yaml.Node) bool {
compareOptions := cmpopts.IgnoreFields(yaml.Node{}, "HeadComment", "LineComment", "FootComment", "Line", "Column", "Style")

if dq.Conditions == nil {
return true
}

for _, c := range dq.Conditions {
results := c.Query.Find(node)
if results == nil {
return false
}

for _, result := range results {
if ok := cmp.Equal(*result, c.Value, compareOptions); !ok {
return false
if !c.Value.IsZero() {
for _, result := range results {
if ok := cmp.Equal(*result, c.Value, compareOptions); !ok {
return false
}
}
}
}
Expand Down

0 comments on commit 4e5720f

Please sign in to comment.