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

Method Validate

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

Source from the content-addressed store, hash-verified

654}
655
656func (v networkFormatValidator) Validate(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues) {
657 root := ast.NavigateAST(a)
658 funcCalls := ast.MatchDescendants(root, ast.FunctionMatcher(v.funcName))
659 for _, call := range funcCalls {
660 callArgs := call.AsCall().Args()
661 if len(callArgs) <= v.argNum {
662 continue
663 }
664 litArg := callArgs[v.argNum]
665 if litArg.Kind() != ast.LiteralKind {
666 continue
667 }
668 if err := v.check(e, call, litArg); err != nil {
669 iss.ReportErrorAtID(litArg.ID(), "invalid %s argument: %v", v.funcName, err)
670 }
671 }
672}
673
674func checkIP(e *cel.Env, call, arg ast.Expr) error {
675 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