-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0097f7
commit b343b57
Showing
5 changed files
with
72 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package assertions | ||
|
||
import "github.com/vmware-tanzu/carvel-ytt/pkg/yamlmeta" | ||
|
||
func AddValidations(node yamlmeta.Node, rules []Rule) { | ||
metas := node.GetMeta("validations") | ||
if currRules, ok := metas.([]Rule); ok { | ||
rules = append(currRules, rules...) | ||
} | ||
SetValidations(node, rules) | ||
} | ||
|
||
func SetValidations(node yamlmeta.Node, rules []Rule) { | ||
node.SetMeta("validations", rules) | ||
} | ||
|
||
func GetValidations(node yamlmeta.Node) []Rule { | ||
metas := node.GetMeta("validations") | ||
if rules, ok := metas.([]Rule); ok { | ||
return rules | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters