MCPcopy
hub / github.com/carvel-dev/ytt / validateValues

Method validateValues

pkg/workspace/library_execution.go:118–134  ·  view source on GitHub ↗

validateValues runs validations on Data Values for the current library. Validations are attached to data value and come from two sources: 1. @schema/validation annotations in a data values schema file. 2. @assert/validate annotations in a data values file. Returns an error if the arguments to an @a

(values *datavalues.Envelope)

Source from the content-addressed store, hash-verified

116// Returns an error if the arguments to an @assert/validate are invalid,
117// otherwise, checks the Check for violations, and returns nil if there are no violations.
118func (ll *LibraryExecution) validateValues(values *datavalues.Envelope) error {
119 err := validations.ProcessAssertValidateAnns(values.Doc)
120 if err != nil {
121 return err
122 }
123
124 chk, err := validations.Run(values.Doc, "run-data-values-validations")
125 if err != nil {
126 return err
127 }
128
129 if chk.HasInvalidations() {
130 return errors.New(chk.ResultsAsString())
131 }
132
133 return nil
134}
135
136func (ll *LibraryExecution) schemaFiles(loader *TemplateLoader) ([]*FileInLibrary, error) {
137 return ll.filesByAnnotation(datavalues.AnnotationDataValuesSchema, loader)

Callers 1

ValuesMethod · 0.95

Calls 5

RunFunction · 0.92
HasInvalidationsMethod · 0.80
NewMethod · 0.80
ResultsAsStringMethod · 0.80

Tested by

no test coverage detected