Update body.md

This commit is contained in:
Lasisi Ibrahim 2025-12-09 22:30:46 +00:00 committed by GitHub
parent 5b28a04d55
commit 94471512bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,13 @@ As it is discouraged, the interactive docs with Swagger UI won't show the docume
## Import Pydantic's `BaseModel` { #import-pydantics-basemodel }
/// note
`BaseModel` is the main class from Pydantic used for creating data models.
FastAPI needs this import to validate request bodies and generate documentation.
///
First, you need to import `BaseModel` from `pydantic`:
{* ../../docs_src/body/tutorial001_py310.py hl[2] *}