]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
๐Ÿ“ Update includes for `docs/en/docs/how-to/separate-openapi-schemas.md` (#12555)
authorSebastiรกn Ramรญrez <tiangolo@gmail.com>
Sat, 26 Oct 2024 16:43:54 +0000 (18:43 +0200)
committerGitHub <noreply@github.com>
Sat, 26 Oct 2024 16:43:54 +0000 (17:43 +0100)
docs/en/docs/how-to/separate-openapi-schemas.md

index 75fd3f9b6166656903d61b5a071ddb871b9d3b86..9a27638fe687b21af750ea7d577466d778230320 100644 (file)
@@ -10,123 +10,13 @@ Let's see how that works and how to change it if you need to do that.
 
 Let's say you have a Pydantic model with default values, like this one:
 
-//// tab | Python 3.10+
-
-```Python hl_lines="7"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
-
-# Code below omitted ๐Ÿ‘‡
-```
-
-<details>
-<summary>๐Ÿ‘€ Full file preview</summary>
-
-```Python
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
-```
-
-</details>
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="9"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-9]!}
-
-# Code below omitted ๐Ÿ‘‡
-```
-
-<details>
-<summary>๐Ÿ‘€ Full file preview</summary>
-
-```Python
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
-```
-
-</details>
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="9"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-9]!}
-
-# Code below omitted ๐Ÿ‘‡
-```
-
-<details>
-<summary>๐Ÿ‘€ Full file preview</summary>
-
-```Python
-{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
-```
-
-</details>
-
-////
+{* ../../docs_src/separate_openapi_schemas/tutorial001_py310.py ln[1:7] hl[7] *}
 
 ### Model for Input
 
 If you use this model as an input like here:
 
-//// tab | Python 3.10+
-
-```Python hl_lines="14"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-15]!}
-
-# Code below omitted ๐Ÿ‘‡
-```
-
-<details>
-<summary>๐Ÿ‘€ Full file preview</summary>
-
-```Python
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
-```
-
-</details>
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="16"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-17]!}
-
-# Code below omitted ๐Ÿ‘‡
-```
-
-<details>
-<summary>๐Ÿ‘€ Full file preview</summary>
-
-```Python
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
-```
-
-</details>
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="16"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-17]!}
-
-# Code below omitted ๐Ÿ‘‡
-```
-
-<details>
-<summary>๐Ÿ‘€ Full file preview</summary>
-
-```Python
-{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
-```
-
-</details>
-
-////
+{* ../../docs_src/separate_openapi_schemas/tutorial001_py310.py ln[1:15] hl[14] *}
 
 ...then the `description` field will **not be required**. Because it has a default value of `None`.
 
@@ -142,29 +32,7 @@ You can confirm that in the docs, the `description` field doesn't have a **red a
 
 But if you use the same model as an output, like here:
 
-//// tab | Python 3.10+
-
-```Python hl_lines="19"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="21"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="21"
-{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
-```
-
-////
+{* ../../docs_src/separate_openapi_schemas/tutorial001_py310.py hl[19] *}
 
 ...then because `description` has a default value, if you **don't return anything** for that field, it will still have that **default value**.
 
@@ -223,29 +91,7 @@ Support for `separate_input_output_schemas` was added in FastAPI `0.102.0`. ๐Ÿค“
 
 ///
 
-//// tab | Python 3.10+
-
-```Python hl_lines="10"
-{!> ../../docs_src/separate_openapi_schemas/tutorial002_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="12"
-{!> ../../docs_src/separate_openapi_schemas/tutorial002_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="12"
-{!> ../../docs_src/separate_openapi_schemas/tutorial002.py!}
-```
-
-////
+{* ../../docs_src/separate_openapi_schemas/tutorial002_py310.py hl[10] *}
 
 ### Same Schema for Input and Output Models in Docs