]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Add deprecation info block about `dict()` in `docs/tutorial/body.md` (#13906)
authorJom Karlo Verzosa <jomkarlov@gmail.com>
Sun, 31 Aug 2025 10:58:56 +0000 (18:58 +0800)
committerGitHub <noreply@github.com>
Sun, 31 Aug 2025 10:58:56 +0000 (10:58 +0000)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
docs/en/docs/tutorial/body.md

index 58e20f4c96f2202c9d5d22bf7757993e8b9c2c00..a820802f7404e678d262c48e4be7897eed575df9 100644 (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.