Skip to content

Commit 411dda6

Browse files
committed
Add note about nested model should inherit BaseModel
1 parent 919a20b commit 411dda6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ from pydantic import BaseModel
249249
from pydantic_settings import BaseSettings, SettingsConfigDict
250250

251251

252-
class DeepSubModel(BaseModel):
252+
class DeepSubModel(BaseModel): # (1)!
253253
v4: str
254254

255255

256-
class SubModel(BaseModel):
256+
class SubModel(BaseModel): # (2)!
257257
v1: str
258258
v2: bytes
259259
v3: int
@@ -276,6 +276,10 @@ print(Settings().model_dump())
276276
"""
277277
```
278278

279+
1. Sub model has to inherit from `pydantic.BaseModel`, Otherwise you may get unexpected results.
280+
281+
2. Sub model has to inherit from `pydantic.BaseModel`, Otherwise you may get unexpected results.
282+
279283
`env_nested_delimiter` can be configured via the `model_config` as shown above, or via the
280284
`_env_nested_delimiter` keyword argument on instantiation.
281285

0 commit comments

Comments
 (0)