@@ -32,67 +32,11 @@ We can use `response_model` to tell FastAPI the schema of the data we want to se
3232
3333For example, we can pass the same ` Hero ` ** SQLModel** class (because it is also a Pydantic model):
3434
35- //// tab | Python 3.10+
36-
37- ``` Python hl_lines="3"
38- # Code above omitted 👆
39-
40- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py310.py[ln:31 - 37 ]!}
41-
42- # Code below omitted 👇
43- ```
44-
45- ////
46-
47- //// tab | Python 3.9+
48-
49- ``` Python hl_lines="3"
50- # Code above omitted 👆
51-
52- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py39.py[ln:33 - 39 ]!}
53-
54- # Code below omitted 👇
55- ```
56-
57- ////
58-
59- //// tab | Python 3.7+
60-
61- ``` Python hl_lines="3"
62- # Code above omitted 👆
63-
64- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001.py[ln:33 - 39 ]!}
65-
66- # Code below omitted 👇
67- ```
68-
69- ////
35+ {* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py ln[ 31:37] hl[ 3] * }
7036
7137/// details | 👀 Full file preview
7238
73- //// tab | Python 3.10+
74-
75- ``` Python
76- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py310.py!}
77- ```
78-
79- ////
80-
81- //// tab | Python 3.9+
82-
83- ``` Python
84- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py39.py!}
85- ```
86-
87- ////
88-
89- //// tab | Python 3.7+
90-
91- ``` Python
92- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001.py!}
93- ```
94-
95- ////
39+ {* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py * }
9640
9741///
9842
@@ -102,71 +46,11 @@ We can also use other type annotations, the same way we can use with Pydantic fi
10246
10347First, we import ` List ` from ` typing ` and then we declare the ` response_model ` with ` List[Hero] ` :
10448
105- //// tab | Python 3.10+
106-
107- ``` Python hl_lines="3"
108-
109- # Code here omitted 👈
110-
111- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py310.py[ln:40 - 44 ]!}
112-
113- # Code below omitted 👇
114- ```
115-
116- ////
117-
118- //// tab | Python 3.9+
119-
120- ``` Python hl_lines="3"
121-
122- # Code here omitted 👈
123-
124- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py39.py[ln:42 - 46 ]!}
125-
126- # Code below omitted 👇
127- ```
128-
129- ////
130-
131- //// tab | Python 3.7+
132-
133- ``` Python hl_lines="1 5"
134- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001.py[ln:1 ]!}
135-
136- # Code here omitted 👈
137-
138- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001.py[ln:42 - 46 ]!}
139-
140- # Code below omitted 👇
141- ```
142-
143- ////
49+ {* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py ln[ 40:44] hl[ 3] * }
14450
14551/// details | 👀 Full file preview
14652
147- //// tab | Python 3.10+
148-
149- ``` Python
150- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py310.py!}
151- ```
152-
153- ////
154-
155- //// tab | Python 3.9+
156-
157- ``` Python
158- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001_py39.py!}
159- ```
160-
161- ////
162-
163- //// tab | Python 3.7+
164-
165- ``` Python
166- {!./ docs_src/ tutorial/ fastapi/ response_model/ tutorial001.py!}
167- ```
168-
169- ////
53+ {* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py * }
17054
17155///
17256
0 commit comments