-
Notifications
You must be signed in to change notification settings - Fork 371
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
Validating parameter using RegExp #2038
Comments
Any sort of parameter validation beyond |
When we move to the System.CommandLine, we will be able to validate on type in the parser. I think we should have additional validation in the backlog:
Anything else? |
Some thoughts I had when the Maui issue was brought up: “ I think we would also want to do the validation at multiple layers. It would be useful if the core engine would do the validation but also be able to expose the validation rule and the error message so that hosts could pre-validate before passing the parameter to the core engine.” |
We need to consider implementing the regex validation in the following layers
The regex to use can be defined on parameter symbol configuration in template.json.
@phenning in case this feature is interested for VS, please let us know here. Once implemented you'll need to implement it in Visual Studio too. It is anticipated that regex for validation should be available via |
We'd also need a feature like this (perhaps not just regex, but numeric range bounds, etc) to have a good interactive prompting experience. The prompt loop would want to accept input and validate it before continuing to the next symbol. |
I think it's a good idea. Are we thinking for 8.0 template engine, or for a 2/3xx? A |
I assume we'd want the regex pattern to be any valid C# pattern., so we need to validate the expression first before using it to validate the input. Question: What is the preferred behavior if the regex pattern in the JSON is an invalid regular expression? |
@joeloff at packaging/testing time we should log build warnings/errors if an invalid regex is used. At instantiation-time we should treat it like any other invalid symbol input - it should be a CLI syntax error. We couldn't validate the input because the thing you asked us to validate with is borked. |
@joeloff you can use #2623 logic to show validation issue during installation or/and instantiation time. |
does the templating engine support validation of parameter values using regex? and/or displaying of error message valid regex is violated?
The text was updated successfully, but these errors were encountered: