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 c23f592
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/assertions/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package assertions

import (
"fmt"

"github.com/k14s/starlark-go/starlark"
"github.com/vmware-tanzu/carvel-ytt/pkg/template"
"github.com/vmware-tanzu/carvel-ytt/pkg/yamlmeta"
Expand Down
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 c23f592

Please sign in to comment.