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

Compile expr in config #11609

Open
antonmedv opened this issue Aug 18, 2023 · 1 comment
Open

Compile expr in config #11609

antonmedv opened this issue Aug 18, 2023 · 1 comment
Labels
area/templating Templating with `{{...}}` type/feature Feature request

Comments

@antonmedv
Copy link

Summary

Looks like expr is used mostly via expr.Eval. While it is a valid usage, precompiling expressions on config save/update can detect a lot of errors.

Consider using expr.Compile. One of the expr features is type checker:

out, err := expr.Compile(`name + age`)
// err: invalid operation + (mismatched types string and int)
// | name + age
// | .....^

Type checker can infer types from Argo env variables, so there is no need to redefine types for expr.

Use Cases

Detecting errors in expression of configuration save/update.


Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.

@antonmedv antonmedv added the type/feature Feature request label Aug 18, 2023
@agilgur5 agilgur5 added the area/templating Templating with `{{...}}` label Aug 18, 2023
@agilgur5
Copy link
Member

agilgur5 commented Sep 4, 2023

This would be a great validation step to add to the operator and CLI, thanks for the suggestion!

Related to the goals of #10017 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/templating Templating with `{{...}}` type/feature Feature request
Projects
None yet
Development

No branches or pull requests

2 participants