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

Method Validate

common/env/env.go:416–438  ·  view source on GitHub ↗

Validate validates the overload configuration is well-formed.

()

Source from the content-addressed store, hash-verified

414
415// Validate validates the overload configuration is well-formed.
416func (od *Overload) Validate() error {
417 if od == nil {
418 return errors.New("invalid overload: nil")
419 }
420 if od.ID == "" {
421 return errors.New("invalid overload: missing overload id")
422 }
423 var errs []error
424 if od.Target != nil {
425 if err := od.Target.Validate(); err != nil {
426 errs = append(errs, fmt.Errorf("invalid overload %q target: %w", od.ID, err))
427 }
428 }
429 for i, arg := range od.Args {
430 if err := arg.Validate(); err != nil {
431 errs = append(errs, fmt.Errorf("invalid overload %q arg[%d]: %w", od.ID, i, err))
432 }
433 }
434 if err := od.Return.Validate(); err != nil {
435 errs = append(errs, fmt.Errorf("invalid overload %q return: %w", od.ID, err))
436 }
437 return errors.Join(errs...)
438}
439
440// AsFunctionOption converts the serializable form of the Overload into a function declaration option.
441func (od *Overload) AsFunctionOption(tp types.Provider) (decls.FunctionOpt, error) {

Callers 1

AsFunctionOptionMethod · 0.95

Calls 2

NewMethod · 0.80
ValidateMethod · 0.65

Tested by

no test coverage detected