diff --git a/docs/tutorial/fastapi/response-model.md b/docs/tutorial/fastapi/response-model.md index b333d58b1a..fa061aa695 100644 --- a/docs/tutorial/fastapi/response-model.md +++ b/docs/tutorial/fastapi/response-model.md @@ -32,67 +32,11 @@ We can use `response_model` to tell FastAPI the schema of the data we want to se For example, we can pass the same `Hero` **SQLModel** class (because it is also a Pydantic model): -//// tab | Python 3.10+ - -```Python hl_lines="3" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py[ln:31-37]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.9+ - -```Python hl_lines="3" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py39.py[ln:33-39]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.7+ - -```Python hl_lines="3" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:33-39]!} - -# Code below omitted 👇 -``` - -//// +{* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py ln[31:37] hl[3] *} /// details | 👀 Full file preview -//// tab | Python 3.10+ - -```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py!} -``` - -//// - -//// tab | Python 3.9+ - -```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py39.py!} -``` - -//// - -//// tab | Python 3.7+ - -```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py!} -``` - -//// +{* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py *} /// @@ -102,71 +46,11 @@ We can also use other type annotations, the same way we can use with Pydantic fi First, we import `List` from `typing` and then we declare the `response_model` with `List[Hero]`: -//// tab | Python 3.10+ - -```Python hl_lines="3" - -# Code here omitted 👈 - -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py[ln:40-44]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.9+ - -```Python hl_lines="3" - -# Code here omitted 👈 - -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py39.py[ln:42-46]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.7+ - -```Python hl_lines="1 5" -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:1]!} - -# Code here omitted 👈 - -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:42-46]!} - -# Code below omitted 👇 -``` - -//// +{* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py ln[40:44] hl[3] *} /// details | 👀 Full file preview -//// tab | Python 3.10+ - -```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py!} -``` - -//// - -//// tab | Python 3.9+ - -```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001_py39.py!} -``` - -//// - -//// tab | Python 3.7+ - -```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py!} -``` - -//// +{* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py *} ///