Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 9dd1e9b

Browse files
feat: introduce some helpers for overlay actions
1 parent 8507f29 commit 9dd1e9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/overlay/utils.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package overlay
2+
3+
import (
4+
"fmt"
5+
"gopkg.in/yaml.v3"
6+
)
7+
8+
func NewTargetSelector(path, method string) string {
9+
return fmt.Sprintf(`$["paths"]["%s"]["%s"]`, path, method)
10+
}
11+
12+
func NewUpdateAction(path, method string, update yaml.Node) Action {
13+
target := NewTargetSelector(path, method)
14+
15+
return Action{
16+
Target: target,
17+
Update: update,
18+
}
19+
}

0 commit comments

Comments
 (0)