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

Function ASTValidators

cel/validator.go:103–120  ·  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

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

Callers 15

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

Calls 1

NameMethod · 0.65