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 face the exact same issue. Is there a fix to put complex datatypes like in nested classes and fill them with the notation with env_nested_delimiter e.g. export BASE_CONFIG__NESTED_CONFIG = '["ListElement0", "ListElement1"]'?
Initial Checks
Description
There is an issue with environment variables using json values for sub modules.
class SubModel(BaseModel):
v1: str = None
l1 : list[str] = None
class Settings(BaseSettings):
sub_model: SubModel = None
os.environ['sub_model'] = '{"v1": "aa", "l1": ["a","b","c"]}'
works
os.environ['sub_model__l1'] = '[1,2,3]'
does not work
After debugging the code i have found the issue:
The method explode_env_vars, extracts the value but does not call parse_env_var for it
Example Code
Python, Pydantic & OS Version
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: