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

Method Validate

common/env/env.go:559–571  ·  view source on GitHub ↗

Validate validates the library configuration is well-formed. For example, setting both the IncludeMacros and ExcludeMacros together could be confusing and create a broken expectation, likewise for IncludeFunctions and ExcludeFunctions.

()

Source from the content-addressed store, hash-verified

557// For example, setting both the IncludeMacros and ExcludeMacros together could be confusing
558// and create a broken expectation, likewise for IncludeFunctions and ExcludeFunctions.
559func (lib *LibrarySubset) Validate() error {
560 if lib == nil {
561 return nil
562 }
563 var errs []error
564 if len(lib.IncludeMacros) != 0 && len(lib.ExcludeMacros) != 0 {
565 errs = append(errs, errors.New("invalid subset: cannot both include and exclude macros"))
566 }
567 if len(lib.IncludeFunctions) != 0 && len(lib.ExcludeFunctions) != 0 {
568 errs = append(errs, errors.New("invalid subset: cannot both include and exclude functions"))
569 }
570 return errors.Join(errs...)
571}
572
573// SubsetFunction produces a function declaration which matches the supported subset, or nil
574// if the function is not supported by the LibrarySubset.

Callers

nothing calls this directly

Calls 1

NewMethod · 0.80

Tested by

no test coverage detected