Skip to content

Commit

Permalink
Add note about nested model should inherit BaseModel
Browse files Browse the repository at this point in the history
  • Loading branch information
hramezani committed Sep 11, 2023
1 parent 4f794c7 commit f7e810d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ from pydantic import BaseModel
from pydantic_settings import BaseSettings, SettingsConfigDict


class DeepSubModel(BaseModel):
class DeepSubModel(BaseModel): # (1)!
v4: str


class SubModel(BaseModel):
class SubModel(BaseModel): # (2)!
v1: str
v2: bytes
v3: int
Expand All @@ -276,6 +276,10 @@ print(Settings().model_dump())
"""
```

1. Sub model has to inherit from `pydantic.BaseModel`, Otherwise you may get unexpected results.

2. Sub model has to inherit from `pydantic.BaseModel`, Otherwise you may get unexpected results.

`env_nested_delimiter` can be configured via the `model_config` as shown above, or via the
`_env_nested_delimiter` keyword argument on instantiation.

Expand Down

0 comments on commit f7e810d

Please sign in to comment.