-
-
Notifications
You must be signed in to change notification settings - Fork 89
ValidationError raised when a field has multiple aliases and one is passed through the constructor and the other is available as an environment variable. #542
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
Comments
Thanks @lucacerone for reporting this issue. Could you please test your example on |
@hramezani thanks for the quick response. I tried and the original issue is fixed, i.e. running:
now does work. However, the behaviour that before worked (having PREFIX_SURNAME as an env variable, and using PREFIX_SURNAME in the constructor), now raises a validation error:
Returns this error:
FYI, this is the version of the packages I am using:
|
Thanks @lucacerone for the feedback. The problem is
@kschwab do you have time to take a look and prepare a fix for this? unfortunately, I am busy these days. I think we need to touch
|
Thanks a lot @hramezani ! |
Hi @lucacerone @hramezani, I created #550 for resolution. It was caused by |
Many thanks for taking care of this @kschwab ! |
Uh oh!
There was an error while loading. Please reload this page.
When a setting class uses multiple aliases for one of the fields, a validation error is raised if I use one alias in the constructor,
but there is an environment variable with the name of the other alias.
This is the version of the packages I have installed:
I define a class like:
If I run:
the object is validated correctly.
However, if there was an environment PREFIX_SURNAME, then the validation would fail.
For example:
fails with this error:
however:
works as I expected, and uses the value "doe" that I explicitly passed through the constructor.
Maybe I have the wrong expectation, but I thought that if I explicitly constructed the object using one of the two aliases, the value coming from the environment should have been discarded, and not passed as an extra argument to the object causing the validation error.
The text was updated successfully, but these errors were encountered: