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)
| 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. |
| 118 | func (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 | |
| 136 | func (ll *LibraryExecution) schemaFiles(loader *TemplateLoader) ([]*FileInLibrary, error) { |
| 137 | return ll.filesByAnnotation(datavalues.AnnotationDataValuesSchema, loader) |
no test coverage detected