Skip to content

[Feature] cel use $ to replace bindings.resolve() #2156

@nkuacac

Description

@nkuacac

Problem Statement

current: (cel;bindings.reslove(outputs_result).Namespaces.exists(ns, ns.ID==bindings.resolve(namespace_id)))
expect: (cel; $outputs_result.Namespaces.exists(ns, ns.ID==$namespace_id))

Solution Description

func parseExpressionRegex(_ context.Context, in string) *Expression {
....
	// parse statement
	if out.Engine == expression.CompilerCEL {
		in = celBindingAdapter(in)
	}
....
}
func celBindingAdapter(in string) string {
	return regexp.MustCompile(`\$([\w-_]+)`).ReplaceAllString(in, "bindings.resolve('$1')")
}

Alternatives

no

Additional Context

No response

Slack discussion

No response

Research

  • I have searched other issues in this repository and mine is not recorded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions