]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
✏️ Fix Pydantic examples in tutorial for Python types (#9961)
authorRahul Salgare <rsalgare95@gmail.com>
Sat, 2 Sep 2023 15:56:35 +0000 (21:26 +0530)
committerGitHub <noreply@github.com>
Sat, 2 Sep 2023 15:56:35 +0000 (17:56 +0200)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
docs_src/python_types/tutorial011.py
docs_src/python_types/tutorial011_py310.py
docs_src/python_types/tutorial011_py39.py

index c8634cbff505a4e4b8d81a02b901474301440ad3..297a84db68ca05edb849af067c31bb84f5a2dbe5 100644 (file)
@@ -6,7 +6,7 @@ from pydantic import BaseModel
 
 class User(BaseModel):
     id: int
-    name = "John Doe"
+    name: str = "John Doe"
     signup_ts: Union[datetime, None] = None
     friends: List[int] = []
 
index 7f173880f5b89a2bd5070e80987d1fe2db4f4bab..842760c60d24f32d4693fbaf8cf8182867049917 100644 (file)
@@ -5,7 +5,7 @@ from pydantic import BaseModel
 
 class User(BaseModel):
     id: int
-    name = "John Doe"
+    name: str = "John Doe"
     signup_ts: datetime | None = None
     friends: list[int] = []
 
index 468496f51932543e909a181a0cbe9c773acdf24c..4eb40b405fe5035a8c9180eb097b75cf33e4419b 100644 (file)
@@ -6,7 +6,7 @@ from pydantic import BaseModel
 
 class User(BaseModel):
     id: int
-    name = "John Doe"
+    name: str = "John Doe"
     signup_ts: Union[datetime, None] = None
     friends: list[int] = []