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

Method Validate

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

Source from the content-addressed store, hash-verified

589}
590
591func (v networkFormatValidator) Validate(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues) {
592 root := ast.NavigateAST(a)
593 funcCalls := ast.MatchDescendants(root, ast.FunctionMatcher(v.funcName))
594 for _, call := range funcCalls {
595 callArgs := call.AsCall().Args()
596 if len(callArgs) <= v.argNum {
597 continue
598 }
599 litArg := callArgs[v.argNum]
600 if litArg.Kind() != ast.LiteralKind {
601 continue
602 }
603 if err := v.check(e, call, litArg); err != nil {
604 iss.ReportErrorAtID(litArg.ID(), "invalid %s argument: %v", v.funcName, err)
605 }
606 }
607}
608
609func checkIP(e *cel.Env, call, arg ast.Expr) error {
610 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