From d8f406d06f1eba3d2eebc224812372cf1a0b1e98 Mon Sep 17 00:00:00 2001 From: natasha41575 Date: Mon, 8 Nov 2021 12:33:30 -0800 Subject: [PATCH] add omitempty tag to replacement sources and targets --- api/types/replacement.go | 4 ++-- kustomize/commands/edit/add/addresource_test.go | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/types/replacement.go b/api/types/replacement.go index 1f59239d9a..cb4163429a 100644 --- a/api/types/replacement.go +++ b/api/types/replacement.go @@ -16,10 +16,10 @@ const DefaultReplacementFieldPath = "metadata.name" // where it is from and where it is to. type Replacement struct { // The source of the value. - Source *SourceSelector `json:"source" yaml:"source"` + Source *SourceSelector `json:"source,omitempty" yaml:"source,omitempty"` // The N fields to write the value to. - Targets []*TargetSelector `json:"targets" yaml:"targets"` + Targets []*TargetSelector `json:"targets,omitempty" yaml:"targets,omitempty"` } // SourceSelector is the source of the replacement transformer. diff --git a/kustomize/commands/edit/add/addresource_test.go b/kustomize/commands/edit/add/addresource_test.go index 1e9679de9a..5f70a83ae8 100644 --- a/kustomize/commands/edit/add/addresource_test.go +++ b/kustomize/commands/edit/add/addresource_test.go @@ -53,8 +53,6 @@ resources: # There could be secrets in Base, if just using a fork/rebase workflow replacements: - path: replacement.yaml - source: null - targets: null `) }