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

When prompting, inputs should be validated immediately #286

Open
drevell opened this issue Nov 16, 2023 · 0 comments
Open

When prompting, inputs should be validated immediately #286

drevell opened this issue Nov 16, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@drevell
Copy link
Contributor

drevell commented Nov 16, 2023

As a template user, when I'm interactively entering input values and I enter a value that fails validation, I want to find out immediately and try again, rather than continuing and failing later.

There's some trickiness here. A validation rule might reference multiple inputs, like rule: 'bool(inputA) || bool(inputB). We can't evaluate this expression until we have values for both inputA and inputB. In the worse case, every rule might reference every variable.

One idea that might be possible: look at the CEL ASTs to see what identifiers they reference (this might be possible using ReferenceInfo). Using that data, we could try one of these ideas:

  • Change the order that we prompt for inputs so that we prefer to prompt for inputs whose validation rules only reference inputs that are already available.
  • Divide the validation rules into two kinds: (1) those that only look at their own single input value, and (2) those that look at other input values. Execute the "kind 1" rules immeditely, but wait until all inputs have been collected before running the "kind 2" rules.

cc @gjonathanhong

@drevell drevell added the enhancement New feature or request label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant