From 94471512bbd3d095845bb77230732b98b0c00833 Mon Sep 17 00:00:00 2001
From: Lasisi Ibrahim <113442282+ibrahimpelumi6142@users.noreply.github.com>
Date: Tue, 9 Dec 2025 22:30:46 +0000
Subject: [PATCH 1/4] Update body.md
---
docs/en/docs/tutorial/body.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/docs/en/docs/tutorial/body.md b/docs/en/docs/tutorial/body.md
index a820802f7..b933adb55 100644
--- a/docs/en/docs/tutorial/body.md
+++ b/docs/en/docs/tutorial/body.md
@@ -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] *}
From d36f22d1b6718721b6d503b29326da665a46f176 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Tue, 9 Dec 2025 22:34:24 +0000
Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/en/docs/tutorial/body.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/en/docs/tutorial/body.md b/docs/en/docs/tutorial/body.md
index b933adb55..75122d653 100644
--- a/docs/en/docs/tutorial/body.md
+++ b/docs/en/docs/tutorial/body.md
@@ -22,7 +22,7 @@ As it is discouraged, the interactive docs with Swagger UI won't show the docume
/// note
-`BaseModel` is the main class from Pydantic used for creating data models.
+`BaseModel` is the main class from Pydantic used for creating data models.
FastAPI needs this import to validate request bodies and generate documentation.
///
From c487e7eee507f18ccaa667f9adb982fa796d7289 Mon Sep 17 00:00:00 2001
From: Lasisi Ibrahim <113442282+ibrahimpelumi6142@users.noreply.github.com>
Date: Tue, 9 Dec 2025 23:25:38 +0000
Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=93=9D=20Add=20validation=20error=20e?=
=?UTF-8?q?xample=20for=20Enum=20path=20parameters?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/en/docs/tutorial/path-params.md | 34 ++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/docs/en/docs/tutorial/path-params.md b/docs/en/docs/tutorial/path-params.md
index 457cc2713..c9e2c3973 100644
--- a/docs/en/docs/tutorial/path-params.md
+++ b/docs/en/docs/tutorial/path-params.md
@@ -166,6 +166,40 @@ Because the available values for the *path parameter* are predefined, the intera
+### Common Validation Errors with Enums { #enum-validation-errors }
+
+When using an `Enum` for a path parameter, FastAPI will validate the value automatically.
+
+For example, if your `ModelName` enum only allows:
+
+- `"alexnet"`
+- `"resnet"`
+- `"lenet"`
+
+And the client sends an invalid value:
+
+```
+GET /models/vgg16
+```
+
+FastAPI returns a clear validation error:
+
+```
+{
+ "detail": [
+ {
+ "type": "enum",
+ "loc": ["path", "model_name"],
+ "msg": "Input should be 'alexnet', 'resnet' or 'lenet'",
+ "input": "vgg16"
+ }
+ ]
+}
+
+```
+
+This helps catch invalid requests before they reach your logic and keeps your API behavior predictable.
+
### Working with Python *enumerations* { #working-with-python-enumerations }
The value of the *path parameter* will be an *enumeration member*.
From 0f940cb4e98f98014bef8ea1e612caca4cc4083b Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Tue, 9 Dec 2025 23:26:32 +0000
Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/en/docs/tutorial/path-params.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/en/docs/tutorial/path-params.md b/docs/en/docs/tutorial/path-params.md
index c9e2c3973..442716904 100644
--- a/docs/en/docs/tutorial/path-params.md
+++ b/docs/en/docs/tutorial/path-params.md
@@ -166,7 +166,7 @@ Because the available values for the *path parameter* are predefined, the intera
-### Common Validation Errors with Enums { #enum-validation-errors }
+### Common Validation Errors with Enums { #common-validation-errors-with-enums }
When using an `Enum` for a path parameter, FastAPI will validate the value automatically.