Iteratively convert PatchesJson6902 to Patches.

This commit is contained in:
Eyob Tefera
2020-08-10 17:57:39 +00:00
parent 2f3c89e73f
commit 45893b2588
3 changed files with 17 additions and 0 deletions

View File

@@ -19,3 +19,9 @@ type PatchJson6902 struct {
// inline patch string
Patch string `json:"patch,omitempty" yaml:"patch,omitempty"`
}
// ToPatch converts a PatchJson6902 to its superset Patch.
func (patch *PatchJson6902) ToPatch() Patch {
selector := patch.Target.ToSelector()
return Patch{Path: patch.Path, Patch: patch.Patch, Target: &selector}
}