func celMatcherJSONMacroExpander(funcName string) parser.MacroExpander {
	return func(eh parser.ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
		if len(args) != 1 {
			return nil, &common.Error{
				Message: "matcher requires a map literal argument",
			}
		}
		arg := args[0]
		switch arg.GetExprKind().(type) {
		case *exprpb.Expr_StructExpr:
			structExpr := arg.GetStructExpr()
			if structExpr.GetMessageName() != "" {
				return nil, &common.Error{
					Location: eh.OffsetLocation(arg.GetId()),
					Message: fmt.Sprintf(
						"matcher input must be a map literal, not a %s",
						structExpr.GetMessageName(),
					),
				}
			}
			for _, entry := range structExpr.GetEntries() {
				isStringPlaceholder := isCELStringExpr(entry.GetMapKey())
				if !isStringPlaceholder {
					return nil, &common.Error{
						Location: eh.OffsetLocation(entry.GetId()),
						Message:  "matcher map keys must be string literals",
					}
				}
				isStringListPlaceholder := isCELStringExpr(entry.GetValue()) ||
					isCELStringListLiteral(entry.GetValue())
				if !isStringListPlaceholder {
					return nil, &common.Error{
						Location: eh.OffsetLocation(entry.GetValue().GetId()),
						Message:  "matcher map values must be string or list literals",
					}
				}
			}
			return eh.GlobalCall(funcName, eh.Ident("request"), arg), nil
		}

		return nil, &common.Error{
			Location: eh.OffsetLocation(arg.GetId()),
			Message:  "matcher requires a map literal argument",
		}
	}
}
// celMatcherStringMacroExpander validates that the macro is called a single
// map literal argument.
//
// The following function call is returned: <funcName>(request, arg)
celMatcherStringMacroExpander validates that the macro is called a single
map literal argument.

The following function call is returned: (request, arg)
// celMatcherStringMacroExpander validates that the macro is called a single // map literal argument . // // The following function call is returned : <funcName > ( request arg )
func celMatcherJSONMacroExpander(funcName string) parser.MacroExpander {
	return func(eh parser.ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
		if len(args) != 1 {
			return nil, &common.Error{
				Message: "matcher requires a map literal argument",
			}
		}
		arg := args[0]
		switch arg.GetExprKind().(type) {
		case *exprpb.Expr_StructExpr:
			structExpr := arg.GetStructExpr()
			if structExpr.GetMessageName() != "" {
				return nil, &common.Error{
					Location: eh.OffsetLocation(arg.GetId()),
					Message: fmt.Sprintf(
						"matcher input must be a map literal, not a %s",
						structExpr.GetMessageName(),
					),
				}
			}
			for _, entry := range structExpr.GetEntries() {
				isStringPlaceholder := isCELStringExpr(entry.GetMapKey())
				if !isStringPlaceholder {
					return nil, &common.Error{
						Location: eh.OffsetLocation(entry.GetId()),
						Message:  "matcher map keys must be string literals",
					}
				}
				isStringListPlaceholder := isCELStringExpr(entry.GetValue()) ||
					isCELStringListLiteral(entry.GetValue())
				if !isStringListPlaceholder {
					return nil, &common.Error{
						Location: eh.OffsetLocation(entry.GetValue().GetId()),
						Message:  "matcher map values must be string or list literals",
					}
				}
			}
			return eh.GlobalCall(funcName, eh.Ident("request"), arg), nil
		}
		return nil, &common.Error{
			Location: eh.OffsetLocation(arg.GetId()),
			Message:  "matcher requires a map literal argument",
		}
	}
}
func celMatcherJSONMacroExpander ( funcName string ) parser . MacroExpander { return func ( eh parser . ExprHelper , target * exprpb . Expr , args [ ] * exprpb . Expr ) ( * exprpb . Expr , * common . Error ) { if len ( args ) != 1 { return nil , & common . Error { Message : " " , } } arg := args [ 0 ] switch arg . GetExprKind ( ) . ( type ) { case * exprpb . Expr_StructExpr : structExpr := arg . GetStructExpr ( ) if structExpr . GetMessageName ( ) != " " { return nil , & common . Error { Location : eh . OffsetLocation ( arg . GetId ( ) ) , Message : fmt . Sprintf ( " " , structExpr . GetMessageName ( ) , ) , } } for _ , entry := range structExpr . GetEntries ( ) { isStringPlaceholder := isCELStringExpr ( entry . GetMapKey ( ) ) if ! isStringPlaceholder { return nil , & common . Error { Location : eh . OffsetLocation ( entry . GetId ( ) ) , Message : " " , } } isStringListPlaceholder := isCELStringExpr ( entry . GetValue ( ) ) || isCELStringListLiteral ( entry . GetValue ( ) ) if ! isStringListPlaceholder { return nil , & common . Error { Location : eh . OffsetLocation ( entry . GetValue ( ) . GetId ( ) ) , Message : " " , } } } return eh . GlobalCall ( funcName , eh . Ident ( " " ) , arg ) , nil } return nil , & common . Error { Location : eh . OffsetLocation ( arg . GetId ( ) ) , Message : " " , } } }
celMatcherStringMacroExpander validates that the macro is called a single
map literal argument.
celMatcherStringMacroExpander validates that the macro is called a single map literal argument .