MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Validate

Method Validate

common/env/env.go:271–285  ·  view source on GitHub ↗

Validate validates the variable configuration is well-formed.

()

Source from the content-addressed store, hash-verified

269
270// Validate validates the variable configuration is well-formed.
271func (v *Variable) Validate() error {
272 if v == nil {
273 return errors.New("invalid variable: nil")
274 }
275 if v.Name == "" {
276 return errors.New("invalid variable: missing variable name")
277 }
278 if err := v.GetType().Validate(); err != nil {
279 return fmt.Errorf("invalid variable %q: %w", v.Name, err)
280 }
281 if v.GetType().IsTypeParam {
282 return fmt.Errorf("invalid variable %q: variables cannot be type parameters", v.Name)
283 }
284 return nil
285}
286
287// GetType returns the variable type description.
288//

Callers 1

AsCELVariableMethod · 0.95

Calls 3

GetTypeMethod · 0.95
NewMethod · 0.80
ValidateMethod · 0.65

Tested by

no test coverage detected