Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 4 additions & 120 deletions docs/tutorial/fastapi/response-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 *}

///

Expand All @@ -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 *}

///

Expand Down
Loading