diff --git a/pkg/assertions/assert.go b/pkg/assertions/assert.go index 213eb729..8147eb30 100644 --- a/pkg/assertions/assert.go +++ b/pkg/assertions/assert.go @@ -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" diff --git a/pkg/assertions/validate.go b/pkg/assertions/validate.go index fa707896..5b6f730a 100644 --- a/pkg/assertions/validate.go +++ b/pkg/assertions/validate.go @@ -1,3 +1,6 @@ +// Copyright 2022 VMware, Inc. +// SPDX-License-Identifier: Apache-2.0 + package assertions import ( diff --git a/pkg/assertions/yamlmeta.go b/pkg/assertions/yamlmeta.go index 542f88ab..41d248da 100644 --- a/pkg/assertions/yamlmeta.go +++ b/pkg/assertions/yamlmeta.go @@ -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 { @@ -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 {