📝 Add deprecation info block about `dict()` in `docs/tutorial/body.md` (#13906)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Jom Karlo Verzosa 2025-08-31 18:58:56 +08:00 committed by GitHub
parent ba9c8fba0b
commit 4584f706bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -128,6 +128,14 @@ Inside of the function, you can access all the attributes of the model object di
{* ../../docs_src/body/tutorial002_py310.py *}
/// info
In Pydantic v1 the method was called `.dict()`, it was deprecated (but still supported) in Pydantic v2, and renamed to `.model_dump()`.
The examples here use `.dict()` for compatibility with Pydantic v1, but you should use `.model_dump()` instead if you can use Pydantic v2.
///
## Request body + path parameters { #request-body-path-parameters }
You can declare path parameters and request body at the same time.