Skip to content
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

Unable to create config with submodel named "api" #278

Open
voodoo11 opened this issue Apr 23, 2024 · 0 comments
Open

Unable to create config with submodel named "api" #278

voodoo11 opened this issue Apr 23, 2024 · 0 comments
Assignees

Comments

@voodoo11
Copy link

voodoo11 commented Apr 23, 2024

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()

Changing submodel name fixes the problem.

@voodoo11 voodoo11 changed the title Unable to create config with submodle named "api" Unable to create config with submodel named "api" Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants