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
I have some value stored in an environment variable that I am reading into a custom BaseSettings subclass. I am using a Field of type SecretStr, with repr=False for this value in the model class. If there is a validation error, and the first value is present, but some other value in the model is missing, then the stack trace includes the value that was present. Should this be default behaviour? Please see below for a reproducible example:
$ export MY_FIRST_VALUE=test123
$ python main.py
...
pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings
other_value
Field required [type=missing, input_value={'MY_FIRST_VALUE: 'test123'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing
The text was updated successfully, but these errors were encountered:
sjking
changed the title
Secret values printed in ValidationError stack traces for BaseSettings
Values printed in ValidationError stack traces for BaseSettings
Mar 16, 2024
I have some value stored in an environment variable that I am reading into a custom
BaseSettings
subclass. I am using aField
of typeSecretStr
, withrepr=False
for this value in the model class. If there is a validation error, and the first value is present, but some other value in the model is missing, then the stack trace includes the value that was present. Should this be default behaviour? Please see below for a reproducible example:The text was updated successfully, but these errors were encountered: