You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although might be logically incorrect to provide an empty default value and a validator together.
But I have noticed that, the following combination fails during copier update.
If there is a question having empty default value and validator, after doing a copier update it gives error that validation has failed for that question. Even if the when condition is not satisfied, then also if gives the error.
This only happens in copier update. In copier copy this does not come up.
Template
Below are the 2 questions.
Even if I answer No to test_enable, the test_var gives validation error
test_enable:
type: bool
help: Do you want to enable test variable
test_var:
type: str
default: ""
when: "[2[ test_enable ]2]"
help: Please provide test variable value
validator: >-
[2% if not (test_var | regex_search('^[a-z0-9\-_]+$')) %2]
test_var should be in lowercase. special character allowed '-_'.
[2% endif %2]
raise ValueError(f"Validation error for question '{var_name}': {err_msg}")ValueError: Validation error for question 'test_var': test_var should be in lowercase. special character allowed '-_'.
Expected behavior
As the when condition is not satisfied, it should not even consider the validation.
Screenshots/screencasts/logs
Operating system
Linux
Operating system distribution and version
22.04 (WSL)
Copier version
copier 9.3.1
Python version
Python 3.10.12
Installation method
pip+git
Additional context
I have not tested this thoroughly. But I have noticed this in my case. In case I am doing something wrong, please feel free to point out.
The text was updated successfully, but these errors were encountered:
Describe the problem
Although might be logically incorrect to provide an empty default value and a validator together.
But I have noticed that, the following combination fails during copier update.
If there is a question having empty
default
value andvalidator
, after doing a copier update it gives error that validation has failed for that question. Even if thewhen
condition is not satisfied, then also if gives the error.This only happens in
copier update
. Incopier copy
this does not come up.Template
Below are the 2 questions.
Even if I answer
No
totest_enable
, thetest_var
gives validation errorKindly note that my envops are different.
To Reproduce
Logs
Expected behavior
As the
when
condition is not satisfied, it should not even consider the validation.Screenshots/screencasts/logs
Operating system
Linux
Operating system distribution and version
22.04 (WSL)
Copier version
copier 9.3.1
Python version
Python 3.10.12
Installation method
pip+git
Additional context
I have not tested this thoroughly. But I have noticed this in my case. In case I am doing something wrong, please feel free to point out.
The text was updated successfully, but these errors were encountered: