Skip to content

Commit

Permalink
update godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
gcheadle-vmware committed Apr 25, 2022
1 parent b343b57 commit e3dc735
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/assertions/validate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

package assertions

import (
Expand Down
6 changes: 6 additions & 0 deletions pkg/assertions/yamlmeta.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

package assertions

import "github.com/vmware-tanzu/carvel-ytt/pkg/yamlmeta"

// AddValidations appends validation Rules to node's validations metadata, later retrieved via GetValidations().
func AddValidations(node yamlmeta.Node, rules []Rule) {
metas := node.GetMeta("validations")
if currRules, ok := metas.([]Rule); ok {
Expand All @@ -10,10 +14,12 @@ func AddValidations(node yamlmeta.Node, rules []Rule) {
SetValidations(node, rules)
}

// SetValidations attaches validation Rules to node's metadata, later retrieved via GetValidations().
func SetValidations(node yamlmeta.Node, rules []Rule) {
node.SetMeta("validations", rules)
}

// GetValidations retrieves validation Rules from node metadata, set previously via SetValidations().
func GetValidations(node yamlmeta.Node) []Rule {
metas := node.GetMeta("validations")
if rules, ok := metas.([]Rule); ok {
Expand Down

0 comments on commit e3dc735

Please sign in to comment.