Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca226e1

Browse files
authored
Merge branch 'master' into patch-1
2 parents c6b8d51 + dbc3008 commit ca226e1

18 files changed

Lines changed: 215 additions & 409 deletions

β€Ždocs/de/docs/tutorial/response-status-code.mdβ€Ž

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ So wie ein Responsemodell, kΓΆnnen Sie auch einen HTTP-Statuscode fΓΌr die Respo
88
* `@app.delete()`
99
* usw.
1010

11-
```Python hl_lines="6"
12-
{!../../docs_src/response_status_code/tutorial001.py!}
13-
```
11+
{* ../../docs_src/response_status_code/tutorial001.py hl[6] *}
1412

1513
/// note | "Hinweis"
1614

@@ -76,19 +74,15 @@ Um mehr ΓΌber Statuscodes zu lernen, und welcher wofΓΌr verwendet wird, lesen Si
7674

7775
Schauen wir uns das vorherige Beispiel noch einmal an:
7876

79-
```Python hl_lines="6"
80-
{!../../docs_src/response_status_code/tutorial001.py!}
81-
```
77+
{* ../../docs_src/response_status_code/tutorial001.py hl[6] *}
8278

8379
`201` ist der Statuscode fΓΌr β€žCreatedβ€œ (β€žErzeugtβ€œ).
8480

8581
Aber Sie mΓΌssen sich nicht daran erinnern, welcher dieser Codes was bedeutet.
8682

8783
Sie kΓΆnnen die Hilfsvariablen von `fastapi.status` verwenden.
8884

89-
```Python hl_lines="1 6"
90-
{!../../docs_src/response_status_code/tutorial002.py!}
91-
```
85+
{* ../../docs_src/response_status_code/tutorial002.py hl[1,6] *}
9286

9387
Diese sind nur eine Annehmlichkeit und enthalten dieselbe Nummer, aber auf diese Weise kΓΆnnen Sie die AutovervollstΓ€ndigung Ihres Editors verwenden, um sie zu finden:
9488

β€Ždocs/en/docs/advanced/behind-a-proxy.mdβ€Ž

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ In this case, the original path `/app` would actually be served at `/api/v1/app`
1818

1919
Even though all your code is written assuming there's just `/app`.
2020

21-
```Python hl_lines="6"
22-
{!../../docs_src/behind_a_proxy/tutorial001.py!}
23-
```
21+
{* ../../docs_src/behind_a_proxy/tutorial001.py hl[6] *}
2422

2523
And the proxy would be **"stripping"** the **path prefix** on the fly before transmitting the request to the app server (probably Uvicorn via FastAPI CLI), keeping your application convinced that it is being served at `/app`, so that you don't have to update all your code to include the prefix `/api/v1`.
2624

@@ -98,9 +96,7 @@ You can get the current `root_path` used by your application for each request, i
9896

9997
Here we are including it in the message just for demonstration purposes.
10098

101-
```Python hl_lines="8"
102-
{!../../docs_src/behind_a_proxy/tutorial001.py!}
103-
```
99+
{* ../../docs_src/behind_a_proxy/tutorial001.py hl[8] *}
104100

105101
Then, if you start Uvicorn with:
106102

@@ -127,9 +123,7 @@ The response would be something like:
127123

128124
Alternatively, if you don't have a way to provide a command line option like `--root-path` or equivalent, you can set the `root_path` parameter when creating your FastAPI app:
129125

130-
```Python hl_lines="3"
131-
{!../../docs_src/behind_a_proxy/tutorial002.py!}
132-
```
126+
{* ../../docs_src/behind_a_proxy/tutorial002.py hl[3] *}
133127

134128
Passing the `root_path` to `FastAPI` would be the equivalent of passing the `--root-path` command line option to Uvicorn or Hypercorn.
135129

@@ -309,9 +303,7 @@ If you pass a custom list of `servers` and there's a `root_path` (because your A
309303

310304
For example:
311305

312-
```Python hl_lines="4-7"
313-
{!../../docs_src/behind_a_proxy/tutorial003.py!}
314-
```
306+
{* ../../docs_src/behind_a_proxy/tutorial003.py hl[4:7] *}
315307

316308
Will generate an OpenAPI schema like:
317309

@@ -358,9 +350,7 @@ The docs UI will interact with the server that you select.
358350

359351
If you don't want **FastAPI** to include an automatic server using the `root_path`, you can use the parameter `root_path_in_servers=False`:
360352

361-
```Python hl_lines="9"
362-
{!../../docs_src/behind_a_proxy/tutorial004.py!}
363-
```
353+
{* ../../docs_src/behind_a_proxy/tutorial004.py hl[9] *}
364354

365355
and then it won't include it in the OpenAPI schema.
366356

β€Ždocs/en/docs/how-to/custom-docs-ui-assets.mdβ€Ž

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ The first step is to disable the automatic docs, as by default, those use the de
1818

1919
To disable them, set their URLs to `None` when creating your `FastAPI` app:
2020

21-
```Python hl_lines="8"
22-
{!../../docs_src/custom_docs_ui/tutorial001.py!}
23-
```
21+
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[8] *}
2422

2523
### Include the custom docs
2624

@@ -36,9 +34,7 @@ You can reuse FastAPI's internal functions to create the HTML pages for the docs
3634

3735
And similarly for ReDoc...
3836

39-
```Python hl_lines="2-6 11-19 22-24 27-33"
40-
{!../../docs_src/custom_docs_ui/tutorial001.py!}
41-
```
37+
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[2:6,11:19,22:24,27:33] *}
4238

4339
/// tip
4440

@@ -54,9 +50,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
5450

5551
Now, to be able to test that everything works, create a *path operation*:
5652

57-
```Python hl_lines="36-38"
58-
{!../../docs_src/custom_docs_ui/tutorial001.py!}
59-
```
53+
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[36:38] *}
6054

6155
### Test it
6256

@@ -158,9 +152,7 @@ The same as when using a custom CDN, the first step is to disable the automatic
158152
159153
To disable them, set their URLs to `None` when creating your `FastAPI` app:
160154
161-
```Python hl_lines="9"
162-
{!../../docs_src/custom_docs_ui/tutorial002.py!}
163-
```
155+
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[9] *}
164156
165157
### Include the custom docs for static files
166158
@@ -176,9 +168,7 @@ Again, you can reuse FastAPI's internal functions to create the HTML pages for t
176168
177169
And similarly for ReDoc...
178170
179-
```Python hl_lines="2-6 14-22 25-27 30-36"
180-
{!../../docs_src/custom_docs_ui/tutorial002.py!}
181-
```
171+
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[2:6,14:22,25:27,30:36] *}
182172
183173
/// tip
184174
@@ -194,9 +184,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
194184
195185
Now, to be able to test that everything works, create a *path operation*:
196186
197-
```Python hl_lines="39-41"
198-
{!../../docs_src/custom_docs_ui/tutorial002.py!}
199-
```
187+
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[39:41] *}
200188
201189
### Test Static Files UI
202190

β€Ždocs/en/docs/how-to/custom-request-and-route.mdβ€Ž

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ If there's no `gzip` in the header, it will not try to decompress the body.
4242

4343
That way, the same route class can handle gzip compressed or uncompressed requests.
4444

45-
```Python hl_lines="8-15"
46-
{!../../docs_src/custom_request_and_route/tutorial001.py!}
47-
```
45+
{* ../../docs_src/custom_request_and_route/tutorial001.py hl[8:15] *}
4846

4947
### Create a custom `GzipRoute` class
5048

@@ -56,9 +54,7 @@ This method returns a function. And that function is what will receive a request
5654

5755
Here we use it to create a `GzipRequest` from the original request.
5856

59-
```Python hl_lines="18-26"
60-
{!../../docs_src/custom_request_and_route/tutorial001.py!}
61-
```
57+
{* ../../docs_src/custom_request_and_route/tutorial001.py hl[18:26] *}
6258

6359
/// note | "Technical Details"
6460

@@ -96,26 +92,18 @@ We can also use this same approach to access the request body in an exception ha
9692

9793
All we need to do is handle the request inside a `try`/`except` block:
9894

99-
```Python hl_lines="13 15"
100-
{!../../docs_src/custom_request_and_route/tutorial002.py!}
101-
```
95+
{* ../../docs_src/custom_request_and_route/tutorial002.py hl[13,15] *}
10296

10397
If an exception occurs, the`Request` instance will still be in scope, so we can read and make use of the request body when handling the error:
10498

105-
```Python hl_lines="16-18"
106-
{!../../docs_src/custom_request_and_route/tutorial002.py!}
107-
```
99+
{* ../../docs_src/custom_request_and_route/tutorial002.py hl[16:18] *}
108100

109101
## Custom `APIRoute` class in a router
110102

111103
You can also set the `route_class` parameter of an `APIRouter`:
112104

113-
```Python hl_lines="26"
114-
{!../../docs_src/custom_request_and_route/tutorial003.py!}
115-
```
105+
{* ../../docs_src/custom_request_and_route/tutorial003.py hl[26] *}
116106

117107
In this example, the *path operations* under the `router` will use the custom `TimedRoute` class, and will have an extra `X-Response-Time` header in the response with the time it took to generate the response:
118108

119-
```Python hl_lines="13-20"
120-
{!../../docs_src/custom_request_and_route/tutorial003.py!}
121-
```
109+
{* ../../docs_src/custom_request_and_route/tutorial003.py hl[13:20] *}

β€Ždocs/en/docs/how-to/extending-openapi.mdβ€Ž

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,18 @@ First, write all your **FastAPI** application as normally:
4545

4646
{* ../../docs_src/extending_openapi/tutorial001.py hl[1,4,7:9] *}
4747

48-
4948
### Generate the OpenAPI schema
5049

5150
Then, use the same utility function to generate the OpenAPI schema, inside a `custom_openapi()` function:
5251

53-
54-
5552
{* ../../docs_src/extending_openapi/tutorial001.py hl[2,15:21] *}
5653

57-
5854
### Modify the OpenAPI schema
5955

6056
Now you can add the ReDoc extension, adding a custom `x-logo` to the `info` "object" in the OpenAPI schema:
6157

6258
{* ../../docs_src/extending_openapi/tutorial001.py hl[22:24] *}
6359

64-
6560
### Cache the OpenAPI schema
6661

6762
You can use the property `.openapi_schema` as a "cache", to store your generated schema.
@@ -70,19 +65,14 @@ That way, your application won't have to generate the schema every time a user o
7065

7166
It will be generated only once, and then the same cached schema will be used for the next requests.
7267

73-
7468
{* ../../docs_src/extending_openapi/tutorial001.py hl[13:14,25:26] *}
7569

76-
7770
### Override the method
7871

7972
Now you can replace the `.openapi()` method with your new function.
8073

81-
82-
8374
{* ../../docs_src/extending_openapi/tutorial001.py hl[29] *}
8475

85-
8676
### Check it
8777

8878
Once you go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a> you will see that you are using your custom logo (in this example, **FastAPI**'s logo):

β€Ždocs/en/docs/how-to/graphql.mdβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ Depending on your use case, you might prefer to use a different library, but if
3535

3636
Here's a small preview of how you could integrate Strawberry with FastAPI:
3737

38-
3938
{* ../../docs_src/graphql/tutorial001.py hl[3,22,25:26] *}
4039

41-
4240
You can learn more about Strawberry in the <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry documentation</a>.
4341

4442
And also the docs about <a href="https://strawberry.rocks/docs/integrations/fastapi" class="external-link" target="_blank">Strawberry with FastAPI</a>.

β€Ždocs/en/docs/release-notes.mdβ€Ž

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@ hide:
99

1010
### Docs
1111

12+
* πŸ“ Update includes in `docs/en/docs/how-to/custom-docs-ui-assets.md`. PR [#12557](https://github.com/fastapi/fastapi/pull/12557) by [@philipokiokio](https://github.com/philipokiokio).
13+
* 🎨 Adjust spacing. PR [#12635](https://github.com/fastapi/fastapi/pull/12635) by [@alejsdev](https://github.com/alejsdev).
14+
* πŸ“ Update includes in `docs/en/docs/how-to/custom-request-and-route.md`. PR [#12560](https://github.com/fastapi/fastapi/pull/12560) by [@philipokiokio](https://github.com/philipokiokio).
15+
16+
### Translations
17+
18+
* 🌐 Add Korean Translation for `docs/ko/docs/advanced/response-change-status-code.md`. PR [#12547](https://github.com/fastapi/fastapi/pull/12547) by [@9zimin9](https://github.com/9zimin9).
19+
20+
## 0.115.4
21+
22+
### Refactors
23+
24+
* ♻️ Update logic to import and check `python-multipart` for compatibility with newer version. PR [#12627](https://github.com/fastapi/fastapi/pull/12627) by [@tiangolo](https://github.com/tiangolo).
25+
26+
### Docs
27+
28+
* πŸ“ Update includes in `docs/fr/docs/tutorial/body.md`. PR [#12596](https://github.com/fastapi/fastapi/pull/12596) by [@kantandane](https://github.com/kantandane).
29+
* πŸ“ Update includes in `docs/fr/docs/tutorial/debugging.md`. PR [#12595](https://github.com/fastapi/fastapi/pull/12595) by [@kantandane](https://github.com/kantandane).
30+
* πŸ“ Update includes in `docs/fr/docs/tutorial/query-params-str-validations.md`. PR [#12591](https://github.com/fastapi/fastapi/pull/12591) by [@kantandane](https://github.com/kantandane).
31+
* πŸ“ Update includes in `docs/fr/docs/tutorial/query-params.md`. PR [#12589](https://github.com/fastapi/fastapi/pull/12589) by [@kantandane](https://github.com/kantandane).
32+
* πŸ“ Update includes in `docs/en/tutorial/body-fields.md`. PR [#12588](https://github.com/fastapi/fastapi/pull/12588) by [@lucaromagnoli](https://github.com/lucaromagnoli).
33+
* πŸ“ Update includes in `docs/de/docs/tutorial/response-status-code.md`. PR [#12585](https://github.com/fastapi/fastapi/pull/12585) by [@abejaranoh](https://github.com/abejaranoh).
34+
* πŸ“ Update includes in `docs/en/docs/tutorial/body.md`. PR [#12586](https://github.com/fastapi/fastapi/pull/12586) by [@lucaromagnoli](https://github.com/lucaromagnoli).
35+
* πŸ“ Update includes in `docs/en/docs/advanced/behind-a-proxy.md`. PR [#12583](https://github.com/fastapi/fastapi/pull/12583) by [@imjuanleonard](https://github.com/imjuanleonard).
36+
* πŸ“ Update includes syntax for `docs/pl/docs/tutorial/first-steps.md`. PR [#12584](https://github.com/fastapi/fastapi/pull/12584) by [@sebkozlo](https://github.com/sebkozlo).
1237
* πŸ“ Update includes in `docs/en/docs/advanced/middleware.md`. PR [#12582](https://github.com/fastapi/fastapi/pull/12582) by [@montanarograziano](https://github.com/montanarograziano).
1338
* πŸ“ Update includes in `docs/en/docs/advanced/additional-status-codes.md`. PR [#12577](https://github.com/fastapi/fastapi/pull/12577) by [@krishnamadhavan](https://github.com/krishnamadhavan).
1439
* πŸ“ Update includes in `docs/en/docs/advanced/advanced-dependencies.md`. PR [#12578](https://github.com/fastapi/fastapi/pull/12578) by [@krishnamadhavan](https://github.com/krishnamadhavan).

0 commit comments

Comments
Β (0)