]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update `docs/en/docs/tutorial/body.md` with Python 3.10 union type example (#11415)
authorCedric L'homme <public@l-homme.com>
Thu, 15 Aug 2024 21:29:58 +0000 (23:29 +0200)
committerGitHub <noreply@github.com>
Thu, 15 Aug 2024 21:29:58 +0000 (16:29 -0500)
Co-authored-by: svlandeg <svlandeg@github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
docs/en/docs/tutorial/body.md

index f3a8685c60c7a0b9e2c31291df11c3b4b087649f..44d2d7da64203cc8d874a26c48d888d52a1800eb 100644 (file)
@@ -237,7 +237,9 @@ The function parameters will be recognized as follows:
 
 FastAPI will know that the value of `q` is not required because of the default value `= None`.
 
-The `Union` in `Union[str, None]` is not used by FastAPI, but will allow your editor to give you better support and detect errors.
+The `str | None` (Python 3.10+) or `Union` in `Union[str, None]` (Python 3.8+) is not used by FastAPI to determine that the value is not required, it will know it's not required because it has a default value of `= None`.
+
+But adding the type annotations will allow your editor to give you better support and detect errors.
 
 ///