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

Function ASTValidators

cel/validator.go:104–121  ·  view source on GitHub ↗

ASTValidators configures a set of ASTValidator instances into the target environment. Validators are applied in the order in which they are specified. If an ASTValidator with the same name is already configured, it will be replaced.

(validators ...ASTValidator)

Source from the content-addressed store, hash-verified

102// Validators are applied in the order in which they are specified.
103// If an ASTValidator with the same name is already configured, it will be replaced.
104func ASTValidators(validators ...ASTValidator) EnvOption {
105 return func(e *Env) (*Env, error) {
106 for _, v := range validators {
107 found := false
108 for i, existing := range e.validators {
109 if existing.Name() == v.Name() {
110 e.validators[i] = v
111 found = true
112 break
113 }
114 }
115 if !found {
116 e.validators = append(e.validators, v)
117 }
118 }
119 return e, nil
120 }
121}
122
123// ASTValidator defines a singleton interface for validating a type-checked Ast against an environment.
124//

Callers 15

TestStringFormatFunction · 0.92
TestStringFormatV2Function · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
configToEnvOptionsFunction · 0.85
ExtendedValidationsFunction · 0.85

Calls 1

NameMethod · 0.65