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

Method Validate

ext/network.go:630–646  ·  view source on GitHub ↗
(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues)

Source from the content-addressed store, hash-verified

628}
629
630func (v networkFormatValidator) Validate(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues) {
631 root := ast.NavigateAST(a)
632 funcCalls := ast.MatchDescendants(root, ast.FunctionMatcher(v.funcName))
633 for _, call := range funcCalls {
634 callArgs := call.AsCall().Args()
635 if len(callArgs) <= v.argNum {
636 continue
637 }
638 litArg := callArgs[v.argNum]
639 if litArg.Kind() != ast.LiteralKind {
640 continue
641 }
642 if err := v.check(e, call, litArg); err != nil {
643 iss.ReportErrorAtID(litArg.ID(), "invalid %s argument: %v", v.funcName, err)
644 }
645 }
646}
647
648func checkIP(e *cel.Env, call, arg ast.Expr) error {
649 pattern := arg.AsLiteral().Value().(string)

Callers

nothing calls this directly

Calls 9

NavigateASTFunction · 0.92
MatchDescendantsFunction · 0.92
FunctionMatcherFunction · 0.92
checkMethod · 0.80
ArgsMethod · 0.65
AsCallMethod · 0.65
KindMethod · 0.65
ReportErrorAtIDMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected