When attempting to create a config with a submodel named "api", an error occurs:
pydantic_settings.sources.SettingsError: error parsing value for field "api" from source "EnvSettingsSource"
How to reproduce:
from pydantic import BaseModel
from pydantic_settings import BaseSettings
class ApiConfig(BaseModel):
foo: str
class Config(BaseSettings):
api: ApiConfig = ApiConfig()
Config()
@voodoo11 Sorry for the late response. sub model name shouldn't make any problem. probably there is an env variable with the name api in your environment.
When attempting to create a config with a submodel named "api", an error occurs:
How to reproduce:
Changing submodel name fixes the problem.