]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update includes in `docs/en/docs/advanced/dataclasses.md` (#12603)
authorMohamed Salman <mohamed.akj@gmail.com>
Mon, 28 Oct 2024 10:35:06 +0000 (16:05 +0530)
committerGitHub <noreply@github.com>
Mon, 28 Oct 2024 10:35:06 +0000 (10:35 +0000)
docs/en/docs/advanced/dataclasses.md

index efc07eab2829c645d0493c926d9840621bc51f27..2936c6d5dc34c8fe1c9d8df79e8584eb0a1a8334 100644 (file)
@@ -4,9 +4,7 @@ FastAPI is built on top of **Pydantic**, and I have been showing you how to use
 
 But FastAPI also supports using <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> the same way:
 
-```Python hl_lines="1  7-12  19-20"
-{!../../docs_src/dataclasses/tutorial001.py!}
-```
+{* ../../docs_src/dataclasses/tutorial001.py hl[1,7:12,19:20] *}
 
 This is still supported thanks to **Pydantic**, as it has <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">internal support for `dataclasses`</a>.
 
@@ -34,9 +32,7 @@ But if you have a bunch of dataclasses laying around, this is a nice trick to us
 
 You can also use `dataclasses` in the `response_model` parameter:
 
-```Python hl_lines="1  7-13  19"
-{!../../docs_src/dataclasses/tutorial002.py!}
-```
+{* ../../docs_src/dataclasses/tutorial002.py hl[1,7:13,19] *}
 
 The dataclass will be automatically converted to a Pydantic dataclass.
 
@@ -52,9 +48,7 @@ In some cases, you might still have to use Pydantic's version of `dataclasses`.
 
 In that case, you can simply swap the standard `dataclasses` with `pydantic.dataclasses`, which is a drop-in replacement:
 
-```{ .python .annotate hl_lines="1  5  8-11  14-17  23-25  28" }
-{!../../docs_src/dataclasses/tutorial003.py!}
-```
+{* ../../docs_src/dataclasses/tutorial003.py hl[1,5,8:11,14:17,23:25,28] *}
 
 1. We still import `field` from standard `dataclasses`.