Skip to content

Commit cf6054d

Browse files
authored
Merge branch 'master' into fix/ci_pydantic
2 parents d482539 + 64feaec commit cf6054d

198 files changed

Lines changed: 1539 additions & 1570 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/en/docs/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ hide:
2020

2121
### Translations
2222

23+
* 🌐 Update translations for zh (update-outdated). PR [#15177](https://github.com/fastapi/fastapi/pull/15177) by [@tiangolo](https://github.com/tiangolo).
24+
* 🌐 Update translations for zh-hant (update-outdated). PR [#15178](https://github.com/fastapi/fastapi/pull/15178) by [@tiangolo](https://github.com/tiangolo).
2325
* 🌐 Update translations for zh-hant (add-missing). PR [#15176](https://github.com/fastapi/fastapi/pull/15176) by [@tiangolo](https://github.com/tiangolo).
2426
* 🌐 Update translations for zh (add-missing). PR [#15175](https://github.com/fastapi/fastapi/pull/15175) by [@tiangolo](https://github.com/tiangolo).
2527
* 🌐 Update translations for ja (update-outdated). PR [#15171](https://github.com/fastapi/fastapi/pull/15171) by [@tiangolo](https://github.com/tiangolo).
@@ -42,6 +44,8 @@ hide:
4244

4345
### Internal
4446

47+
* ⬆ Bump authlib from 1.6.7 to 1.6.9. PR [#15128](https://github.com/fastapi/fastapi/pull/15128) by [@dependabot[bot]](https://github.com/apps/dependabot).
48+
* ⬆ Bump pyasn1 from 0.6.2 to 0.6.3. PR [#15143](https://github.com/fastapi/fastapi/pull/15143) by [@dependabot[bot]](https://github.com/apps/dependabot).
4549
* ⬆ Bump ujson from 5.11.0 to 5.12.0. PR [#15150](https://github.com/fastapi/fastapi/pull/15150) by [@dependabot[bot]](https://github.com/apps/dependabot).
4650
* 🔨 Tweak translation workflow and translation fixer tool. PR [#15166](https://github.com/fastapi/fastapi/pull/15166) by [@YuriiMotov](https://github.com/YuriiMotov).
4751
* 🔨 Fix `commit_in_place` passed via env variable in `translate.yml` workflow. PR [#15151](https://github.com/fastapi/fastapi/pull/15151) by [@YuriiMotov](https://github.com/YuriiMotov).

docs/zh-hant/docs/_llm-test.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* 檢查翻譯是否正確。
1212
* 如有需要,改進你的語言特定提示、通用提示,或英文原文。
1313
* 然後手動修正翻譯中剩下的問題,讓它成為一個好的譯文。
14-
* 重新翻譯,並保留這份好的譯文。理想結果是 LLM 不再對該譯文做任何變更。這代表通用提示與你的語言特定提示已經盡可能完善(有時它仍可能做出幾個看似隨機的變更,原因是<a href="https://doublespeak.chat/#/handbook#deterministic-output" class="external-link" target="_blank">LLMs 並非決定性演算法</a>)。
14+
* 重新翻譯,並保留這份好的譯文。理想結果是 LLM 不再對該譯文做任何變更。這代表通用提示與你的語言特定提示已經盡可能完善(有時它仍可能做出幾個看似隨機的變更,原因是[LLMs 並非決定性演算法](https://doublespeak.chat/#/handbook#deterministic-output))。
1515

1616
測試:
1717

@@ -95,7 +95,7 @@ $ <font color="#4E9A06">fastapi</font> run <u style="text-decoration-style:solid
9595
...以及另一個主控台範例...
9696

9797
```console
98-
// 建立目錄 "code"
98+
// 建立目錄 "Code"
9999
$ mkdir code
100100
// 切換到該目錄
101101
$ cd code
@@ -169,15 +169,15 @@ Some text
169169
連結文字應被翻譯,連結位址應保持不變:
170170

171171
* [連結到上方標題](#code-snippets)
172-
* [內部連結](index.md#installation){.internal-link target=_blank}
173-
* <a href="https://sqlmodel.tiangolo.com/" class="external-link" target="_blank">外部連結</a>
174-
* <a href="https://fastapi.tiangolo.com/css/styles.css" class="external-link" target="_blank">連結到樣式</a>
175-
* <a href="https://fastapi.tiangolo.com/js/logic.js" class="external-link" target="_blank">連結到腳本</a>
176-
* <a href="https://fastapi.tiangolo.com/img/foo.jpg" class="external-link" target="_blank">連結到圖片</a>
172+
* [內部連結](index.md#installation)
173+
* [外部連結](https://sqlmodel.tiangolo.com/)
174+
* [連結到樣式](https://fastapi.tiangolo.com/css/styles.css)
175+
* [連結到腳本](https://fastapi.tiangolo.com/js/logic.js)
176+
* [連結到圖片](https://fastapi.tiangolo.com/img/foo.jpg)
177177

178178
連結文字應被翻譯,連結位址應指向對應的翻譯版本:
179179

180-
* <a href="https://fastapi.tiangolo.com/zh-hant/" class="external-link" target="_blank">FastAPI 連結</a>
180+
* [FastAPI 連結](https://fastapi.tiangolo.com/zh-hant/)
181181

182182
////
183183

@@ -291,7 +291,7 @@ Hello again.
291291
* 即時
292292
* 標準
293293
* 預設
294-
* 區分大小寫
294+
* 区分大小寫
295295
* 不區分大小寫
296296

297297
* 提供應用程式服務

docs/zh-hant/docs/advanced/additional-responses.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,5 @@ new_dict = {**old_dict, "new key": "new value"}
243243

244244
若要查看回應中究竟可以包含哪些內容,你可以參考 OpenAPI 規範中的這些章節:
245245

246-
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responses-object" class="external-link" target="_blank">OpenAPI Responses 物件</a>,其中包含 `Response Object`
247-
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#response-object" class="external-link" target="_blank">OpenAPI Response 物件</a>,你可以把這裡的任何內容直接放到 `responses` 參數內各個回應中。包含 `description``headers``content`(在其中宣告不同的媒體型別與 JSON Schemas)、以及 `links`
246+
* [OpenAPI Responses 物件](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responses-object),其中包含 `Response Object`
247+
* [OpenAPI Response 物件](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#response-object),你可以把這裡的任何內容直接放到 `responses` 參數內各個回應中。包含 `description``headers``content`(在其中宣告不同的媒體型別與 JSON Schemas)、以及 `links`

docs/zh-hant/docs/advanced/additional-status-codes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
///
2828

29-
/// note | 注意
29+
/// note | 技術細節
3030

3131
你也可以使用 `from starlette.responses import JSONResponse`
3232

@@ -38,4 +38,4 @@
3838

3939
如果你直接回傳額外的狀態碼與回應,它們不會被包含進 OpenAPI 綱要(API 文件)中,因為 FastAPI 無法事先知道你會回傳什麼。
4040

41-
但你可以在程式碼中補充文件,使用:[額外的回應](additional-responses.md){.internal-link target=_blank}
41+
但你可以在程式碼中補充文件,使用:[額外的回應](additional-responses.md)

docs/zh-hant/docs/advanced/advanced-dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ checker(q="somequery")
132132

133133
如此一來,該 session 就會釋放資料庫連線,讓其他請求可以使用。
134134

135-
如果你有不同的情境,需要從含有 `yield` 的相依中提早結束,請建立一個 <a href="https://github.com/fastapi/fastapi/discussions/new?category=questions" class="external-link" target="_blank">GitHub 討論問題</a>,描述你的具體情境,以及為何提早關閉含有 `yield` 的相依對你有幫助。
135+
如果你有不同的情境,需要從含有 `yield` 的相依中提早結束,請建立一個 [GitHub 討論問題](https://github.com/fastapi/fastapi/discussions/new?category=questions),描述你的具體情境,以及為何提早關閉含有 `yield` 的相依對你有幫助。
136136

137137
如果有令人信服的案例需要在含有 `yield` 的相依中提前關閉,我會考慮加入一種新的選項,讓你可以選擇性啟用提前關閉。
138138

@@ -144,7 +144,7 @@ checker(q="somequery")
144144

145145
### 背景任務與含有 `yield` 的相依,技術細節 { #background-tasks-and-dependencies-with-yield-technical-details }
146146

147-
在 FastAPI 0.106.0 之前,不可能在 `yield` 之後拋出例外;含有 `yield` 的相依的結束程式碼會在回應送出之後才執行,因此[例外處理器](../tutorial/handling-errors.md#install-custom-exception-handlers){.internal-link target=_blank} 早就已經跑完了。
147+
在 FastAPI 0.106.0 之前,不可能在 `yield` 之後拋出例外;含有 `yield` 的相依的結束程式碼會在回應送出之後才執行,因此[例外處理器](../tutorial/handling-errors.md#install-custom-exception-handlers) 早就已經跑完了。
148148

149149
當初這樣設計主要是為了允許在背景任務中使用由相依「yield」出來的同一組物件,因為結束程式碼會在背景任務結束後才執行。
150150

docs/zh-hant/docs/advanced/async-tests.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
`TestClient` 在內部做了一些魔法,讓我們能在一般的 `def` 測試函式中,使用標準 pytest 來呼叫非同步的 FastAPI 應用。但當我們在非同步函式中使用它時,這個魔法就不再奏效了。也就是說,當以非同步方式執行測試時,就不能在測試函式內使用 `TestClient`
1818

19-
`TestClient` 是建立在 <a href="https://www.python-httpx.org" class="external-link" target="_blank">HTTPX</a> 之上,所幸我們可以直接使用它來測試 API。
19+
`TestClient` 是建立在 [HTTPX](https://www.python-httpx.org) 之上,所幸我們可以直接使用它來測試 API。
2020

2121
## 範例 { #example }
2222

23-
作為簡單範例,讓我們考慮與[更大型的應用](../tutorial/bigger-applications.md){.internal-link target=_blank}[測試](../tutorial/testing.md){.internal-link target=_blank}中描述的類似檔案結構:
23+
作為簡單範例,讓我們考慮與[更大型的應用](../tutorial/bigger-applications.md)[測試](../tutorial/testing.md)中描述的類似檔案結構:
2424

2525
```
2626
.
@@ -84,7 +84,7 @@ response = client.get('/')
8484

8585
/// warning
8686

87-
如果你的應用仰賴 lifespan 事件,`AsyncClient` 不會觸發這些事件。若要確保它們被觸發,請使用 <a href="https://github.com/florimondmanca/asgi-lifespan#usage" class="external-link" target="_blank">florimondmanca/asgi-lifespan</a>`LifespanManager`
87+
如果你的應用仰賴 lifespan 事件,`AsyncClient` 不會觸發這些事件。若要確保它們被觸發,請使用 [florimondmanca/asgi-lifespan](https://github.com/florimondmanca/asgi-lifespan#usage)`LifespanManager`
8888

8989
///
9090

@@ -94,6 +94,6 @@ response = client.get('/')
9494

9595
/// tip
9696

97-
如果在將非同步呼叫整合進測試時遇到 `RuntimeError: Task attached to a different loop`(例如使用 <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDB 的 MotorClient</a> 時),請記得:需要事件迴圈的物件只應在非同步函式內實例化,例如在 `@app.on_event("startup")` 回呼中。
97+
如果在將非同步呼叫整合進測試時遇到 `RuntimeError: Task attached to a different loop`(例如使用 [MongoDB 的 MotorClient](https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop) 時),請記得:需要事件迴圈的物件只應在非同步函式內實例化,例如在 `@app.on_event("startup")` 回呼中。
9898

9999
///

docs/zh-hant/docs/advanced/behind-a-proxy.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
代理相關的標頭有:
1818

19-
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-For" class="external-link" target="_blank">X-Forwarded-For</a>
20-
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Proto" class="external-link" target="_blank">X-Forwarded-Proto</a>
21-
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Host" class="external-link" target="_blank">X-Forwarded-Host</a>
19+
* [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-For)
20+
* [X-Forwarded-Proto](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Proto)
21+
* [X-Forwarded-Host](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Host)
2222

2323
///
2424

@@ -60,7 +60,7 @@ https://mysuperapp.com/items/
6060

6161
/// tip
6262

63-
如果你想了解更多 HTTPS 的內容,請參考指南[[關於 HTTPS](../deployment/https.md){.internal-link target=_blank}]。
63+
如果你想了解更多 HTTPS 的內容,請參考指南[[關於 HTTPS](../deployment/https.md)]。
6464

6565
///
6666

@@ -228,7 +228,7 @@ $ fastapi run main.py --forwarded-allow-ips="*" --root-path /api/v1
228228

229229
請記住,伺服器(Uvicorn)除了把 `root_path` 傳給應用之外,不會拿它做其他用途。
230230

231-
但如果你用瀏覽器前往 <a href="http://127.0.0.1:8000/app" class="external-link" target="_blank">http://127.0.0.1:8000/app</a>,你會看到一般的回應:
231+
但如果你用瀏覽器前往 [http://127.0.0.1:8000/app](http://127.0.0.1:8000/app) ,你會看到一般的回應:
232232

233233
```JSON
234234
{
@@ -251,9 +251,9 @@ Uvicorn 會預期代理以 `http://127.0.0.1:8000/app` 來存取 Uvicorn,而
251251

252252
## 在本機使用 Traefik 測試 { #testing-locally-with-traefik }
253253

254-
你可以很容易地用 <a href="https://docs.traefik.io/" class="external-link" target="_blank">Traefik</a> 在本機跑一個「移除路徑前綴」的測試。
254+
你可以很容易地用 [Traefik](https://docs.traefik.io/) 在本機跑一個「移除路徑前綴」的測試。
255255

256-
<a href="https://github.com/containous/traefik/releases" class="external-link" target="_blank">下載 Traefik</a>,它是一個單一的執行檔,你可以解壓縮後直接在終端機執行。
256+
[下載 Traefik](https://github.com/containous/traefik/releases),它是一個單一的執行檔,你可以解壓縮後直接在終端機執行。
257257

258258
然後建立一個 `traefik.toml` 檔案,內容如下:
259259

@@ -330,7 +330,7 @@ $ fastapi run main.py --forwarded-allow-ips="*" --root-path /api/v1
330330

331331
### 檢查回應 { #check-the-responses }
332332

333-
現在,如果你前往 Uvicorn 的埠:<a href="http://127.0.0.1:8000/app" class="external-link" target="_blank">http://127.0.0.1:8000/app</a>,你會看到一般的回應:
333+
現在,如果你前往 Uvicorn 的埠:[http://127.0.0.1:8000/app](http://127.0.0.1:8000/app),你會看到一般的回應:
334334

335335
```JSON
336336
{
@@ -345,7 +345,7 @@ $ fastapi run main.py --forwarded-allow-ips="*" --root-path /api/v1
345345

346346
///
347347

348-
接著打開使用 Traefik 埠且包含路徑前綴的 URL:<a href="http://127.0.0.1:9999/api/v1/app" class="external-link" target="_blank">http://127.0.0.1:9999/api/v1/app</a>
348+
接著打開使用 Traefik 埠且包含路徑前綴的 URL:[http://127.0.0.1:9999/api/v1/app](http://127.0.0.1:9999/api/v1/app)
349349

350350
我們會得到相同的回應:
351351

@@ -370,13 +370,13 @@ $ fastapi run main.py --forwarded-allow-ips="*" --root-path /api/v1
370370

371371
「正式」的存取方式應該是透過我們定義了路徑前綴的代理。因此,如我們預期,如果你直接透過 Uvicorn 供應的文件 UI、而 URL 中沒有該路徑前綴,那它不會運作,因為它預期要透過代理來存取。
372372

373-
你可以在 <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a> 檢查:
373+
你可以在 [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) 檢查:
374374

375375
<img src="/img/tutorial/behind-a-proxy/image01.png">
376376

377377
但如果我們改用「正式」的 URL,也就是使用埠號 `9999` 的代理、並在 `/api/v1/docs`,它就能正確運作了!🎉
378378

379-
你可以在 <a href="http://127.0.0.1:9999/api/v1/docs" class="external-link" target="_blank">http://127.0.0.1:9999/api/v1/docs</a> 檢查:
379+
你可以在 [http://127.0.0.1:9999/api/v1/docs](http://127.0.0.1:9999/api/v1/docs) 檢查:
380380

381381
<img src="/img/tutorial/behind-a-proxy/image02.png">
382382

@@ -433,7 +433,7 @@ $ fastapi run main.py --forwarded-allow-ips="*" --root-path /api/v1
433433

434434
///
435435

436-
在位於 <a href="http://127.0.0.1:9999/api/v1/docs" class="external-link" target="_blank">http://127.0.0.1:9999/api/v1/docs</a> 的文件 UI 中看起來會像這樣:
436+
在位於 [http://127.0.0.1:9999/api/v1/docs](http://127.0.0.1:9999/api/v1/docs) 的文件 UI 中看起來會像這樣:
437437

438438
<img src="/img/tutorial/behind-a-proxy/image03.png">
439439

@@ -461,6 +461,6 @@ OpenAPI 規格中的 `servers` 屬性是可選的。
461461

462462
## 掛載子應用 { #mounting-a-sub-application }
463463

464-
如果你需要在同時使用具有 `root_path` 的代理時,掛載一個子應用(如[[子應用 - 掛載](sub-applications.md){.internal-link target=_blank}]中所述),可以像平常一樣操作,正如你所預期的那樣。
464+
如果你需要在同時使用具有 `root_path` 的代理時,掛載一個子應用(如[[子應用 - 掛載](sub-applications.md)]中所述),可以像平常一樣操作,正如你所預期的那樣。
465465

466466
FastAPI 會在內部智慧地使用 `root_path`,所以一切都能順利運作。✨

0 commit comments

Comments
 (0)