Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
nkuacac opened this issue Nov 18, 2024 · 0 comments
Open
1 task done

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

nkuacac opened this issue Nov 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nkuacac
Copy link

nkuacac commented Nov 18, 2024

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.
@nkuacac nkuacac added the enhancement New feature or request label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant