diff --git a/docs/en/docs/release-notes.md b/docs/en/docs/release-notes.md index 0ee96b453..920ae414d 100644 --- a/docs/en/docs/release-notes.md +++ b/docs/en/docs/release-notes.md @@ -9,10 +9,13 @@ hide: ### Docs +* βοΈ Fix minor typos in `docs/ko/docs/`. PR [#11126](https://github.com/tiangolo/fastapi/pull/11126) by [@KaniKim](https://github.com/KaniKim). * βοΈ Fix minor typo in `fastapi/applications.py`. PR [#11099](https://github.com/tiangolo/fastapi/pull/11099) by [@JacobHayes](https://github.com/JacobHayes). ### Translations +* π Add Korean translation for `/docs/ko/docs/tutorial/dependencies/global-dependencies.md`. PR [#11123](https://github.com/tiangolo/fastapi/pull/11123) by [@riroan](https://github.com/riroan). +* π Add Korean translation for `/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md`. PR [#11124](https://github.com/tiangolo/fastapi/pull/11124) by [@riroan](https://github.com/riroan). * π Add Korean translation for `/docs/ko/docs/tutorial/schema-extra-example.md`. PR [#11121](https://github.com/tiangolo/fastapi/pull/11121) by [@KaniKim](https://github.com/KaniKim). * π Add Korean translation for `/docs/ko/docs/tutorial/body-fields.md`. PR [#11112](https://github.com/tiangolo/fastapi/pull/11112) by [@KaniKim](https://github.com/KaniKim). * π Add Korean translation for `/docs/ko/docs/tutorial/cookie-params.md`. PR [#11118](https://github.com/tiangolo/fastapi/pull/11118) by [@riroan](https://github.com/riroan). diff --git a/docs/ko/docs/tutorial/background-tasks.md b/docs/ko/docs/tutorial/background-tasks.md index a951ead16..ee83d6570 100644 --- a/docs/ko/docs/tutorial/background-tasks.md +++ b/docs/ko/docs/tutorial/background-tasks.md @@ -13,7 +13,7 @@ FastAPIμμλ μλ΅μ λ°νν νμ μ€νν λ°±κ·ΈλΌμ΄λ μμ μ ## `λ°±κ·ΈλΌμ΄λ μμ ` μ¬μ© -λ¨Όμ μλμ κ°μ΄ `BackgroundTasks`λ₯Ό μν¬νΈνκ³ , `BackgroundTasks`λ₯Ό _κ²½λ‘ λμ ν¨μ_ μμ 맀κ°λ³μλ‘ κ°μ Έμ€κ³ μ μν©λλ€. +λ¨Όμ μλμ κ°μ΄ `BackgroundTasks`λ₯Ό μν¬νΈνκ³ , `BackgroundTasks`λ₯Ό _κ²½λ‘ μλ ν¨μ_ μμ 맀κ°λ³μλ‘ κ°μ Έμ€κ³ μ μν©λλ€. ```Python hl_lines="1 13" {!../../../docs_src/background_tasks/tutorial001.py!} @@ -39,7 +39,7 @@ FastAPIμμλ μλ΅μ λ°νν νμ μ€νν λ°±κ·ΈλΌμ΄λ μμ μ ## λ°±κ·ΈλΌμ΄λ μμ μΆκ° -_κ²½λ‘ λμ ν¨μ_ λ΄μμ μμ ν¨μλ₯Ό `.add_task()` ν¨μ ν΅ν΄ _λ°±κ·ΈλΌμ΄λ μμ _ κ°μ²΄μ μ λ¬ν©λλ€. +_κ²½λ‘ μλ ν¨μ_ λ΄μμ μμ ν¨μλ₯Ό `.add_task()` ν¨μ ν΅ν΄ _λ°±κ·ΈλΌμ΄λ μμ _ κ°μ²΄μ μ λ¬ν©λλ€. ```Python hl_lines="14" {!../../../docs_src/background_tasks/tutorial001.py!} @@ -53,7 +53,7 @@ _κ²½λ‘ λμ ν¨μ_ λ΄μμ μμ ν¨μλ₯Ό `.add_task()` ν¨μ ν΅ν΄ _ ## μμ‘΄μ± μ£Όμ -`BackgroundTasks`λ₯Ό μμ‘΄μ± μ£Όμ μμ€ν κ³Ό ν¨κ» μ¬μ©νλ©΄ _κ²½λ‘ λμ ν¨μ_, μ’ μμ±, νμ μ’ μμ± λ± μ¬λ¬ μμ€μμ BackgroundTasks μ νμ 맀κ°λ³μλ₯Ό μ μΈν μ μμ΅λλ€. +`BackgroundTasks`λ₯Ό μμ‘΄μ± μ£Όμ μμ€ν κ³Ό ν¨κ» μ¬μ©νλ©΄ _κ²½λ‘ μλ ν¨μ_, μ’ μμ±, νμ μ’ μμ± λ± μ¬λ¬ μμ€μμ BackgroundTasks μ νμ 맀κ°λ³μλ₯Ό μ μΈν μ μμ΅λλ€. **FastAPI**λ κ° κ²½μ°μ μνν μμ κ³Ό λμΌν κ°μ²΄λ₯Ό λ΄λΆμ μΌλ‘ μ¬μ¬μ©νκΈ°μ, λͺ¨λ λ°±κ·ΈλΌμ΄λ μμ μ΄ ν¨κ» λ³ν©λκ³ λμ€μ λ°±κ·ΈλΌμ΄λμμ μ€νλ©λλ€. @@ -73,7 +73,7 @@ _κ²½λ‘ λμ ν¨μ_ λ΄μμ μμ ν¨μλ₯Ό `.add_task()` ν¨μ ν΅ν΄ _ μμ²μ μΏΌλ¦¬κ° μλ κ²½μ° λ°±κ·ΈλΌμ΄λ μμ μ λ‘κ·Έμ κΈ°λ‘λ©λλ€. -κ·Έλ¦¬κ³ _κ²½λ‘ λμ ν¨μ_ μμ μμ±λ λ λ€λ₯Έ λ°±κ·ΈλΌμ΄λ μμ μ κ²½λ‘ λ§€κ° λ³μλ₯Ό νμ©νμ¬ μ¬μ©νμ¬ λ©μμ§λ₯Ό μμ±ν©λλ€. +κ·Έλ¦¬κ³ _κ²½λ‘ μλ ν¨μ_ μμ μμ±λ λ λ€λ₯Έ λ°±κ·ΈλΌμ΄λ μμ μ κ²½λ‘ λ§€κ° λ³μλ₯Ό νμ©νμ¬ μ¬μ©νμ¬ λ©μμ§λ₯Ό μμ±ν©λλ€. ## κΈ°μ μ μΈλΆμ¬ν @@ -81,7 +81,7 @@ _κ²½λ‘ λμ ν¨μ_ λ΄μμ μμ ν¨μλ₯Ό `.add_task()` ν¨μ ν΅ν΄ _ `BackgroundTasks` ν΄λμ€λ FastAPIμμ μ§μ μν¬νΈνκ±°λ ν¬ν¨νκΈ° λλ¬Έμ μ€μλ‘ `BackgroundTask` (λμ `s`κ° μμ)μ μν¬νΈνλλΌλ starlette.backgroundμμ `BackgroundTask`λ₯Ό κ°μ Έμ€λ κ²μ λ°©μ§ν μ μμ΅λλ€. -(`BackgroundTask`κ° μλ) `BackgroundTasks`λ₯Ό μ¬μ©νλ©΄, _κ²½λ‘ λμ ν¨μ_ 맀κ°λ³μλ‘ μ¬μ©ν μ μκ² λκ³ λλ¨Έμ§λ **FastAPI**κ° λμ μ²λ¦¬νλλ‘ ν μ μμ΅λλ€. μ΄κ²μ `Request` κ°μ²΄λ₯Ό μ§μ μ¬μ©νλ κ²κ³Ό κ°μ λ°©μμ λλ€. +(`BackgroundTask`κ° μλ) `BackgroundTasks`λ₯Ό μ¬μ©νλ©΄, _κ²½λ‘ μλ ν¨μ_ 맀κ°λ³μλ‘ μ¬μ©ν μ μκ² λκ³ λλ¨Έμ§λ **FastAPI**κ° λμ μ²λ¦¬νλλ‘ ν μ μμ΅λλ€. μ΄κ²μ `Request` κ°μ²΄λ₯Ό μ§μ μ¬μ©νλ κ²κ³Ό κ°μ λ°©μμ λλ€. FastAPIμμ `BackgroundTask`λ₯Ό λ¨λ μΌλ‘ μ¬μ©νλ κ²μ μ¬μ ν κ°λ₯ν©λλ€. νμ§λ§ κ°μ²΄λ₯Ό μ½λμμ μμ±νκ³ , μ΄ κ°μ²΄λ₯Ό ν¬ν¨νλ Starlette `Response`λ₯Ό λ°νν΄μΌ ν©λλ€. @@ -99,4 +99,4 @@ RabbitMQ λλ Redisμ κ°μ λ©μμ§/μμ ν μμ€ν λ³΄λ€ λ³΅μ‘ν ## μμ½ -λ°±κ·ΈλΌμ΄λ μμ μ μΆκ°νκΈ° μν΄ _κ²½λ‘ λμ ν¨μ_ μ 맀κ°λ³μλ‘ `BackgroundTasks`λ₯Ό κ°μ Έμ€κ³ μ¬μ©ν©λλ€. +λ°±κ·ΈλΌμ΄λ μμ μ μΆκ°νκΈ° μν΄ _κ²½λ‘ μλ ν¨μ_ μ 맀κ°λ³μλ‘ `BackgroundTasks`λ₯Ό κ°μ Έμ€κ³ μ¬μ©ν©λλ€. diff --git a/docs/ko/docs/tutorial/body-fields.md b/docs/ko/docs/tutorial/body-fields.md index a739756bd..fc7209726 100644 --- a/docs/ko/docs/tutorial/body-fields.md +++ b/docs/ko/docs/tutorial/body-fields.md @@ -1,6 +1,6 @@ # λ³Έλ¬Έ - νλ -`Query`, `Path`μ `Body`λ₯Ό μ¬μ©ν΄ *κ²½λ‘ λμ ν¨μ* 맀κ°λ³μ λ΄μμ μΆκ°μ μΈ κ²μ¦μ΄λ λ©νλ°μ΄ν°λ₯Ό μ μΈν κ²μ²λΌ Pydanticμ `Field`λ₯Ό μ¬μ©νμ¬ λͺ¨λΈ λ΄μμ κ²μ¦κ³Ό λ©νλ°μ΄ν°λ₯Ό μ μΈν μ μμ΅λλ€. +`Query`, `Path`μ `Body`λ₯Ό μ¬μ©ν΄ *κ²½λ‘ μλ ν¨μ* 맀κ°λ³μ λ΄μμ μΆκ°μ μΈ κ²μ¦μ΄λ λ©νλ°μ΄ν°λ₯Ό μ μΈν κ²μ²λΌ Pydanticμ `Field`λ₯Ό μ¬μ©νμ¬ λͺ¨λΈ λ΄μμ κ²μ¦κ³Ό λ©νλ°μ΄ν°λ₯Ό μ μΈν μ μμ΅λλ€. ## `Field` μν¬νΈ diff --git a/docs/ko/docs/tutorial/body-multiple-params.md b/docs/ko/docs/tutorial/body-multiple-params.md index 034c2e84c..2cf5df7f3 100644 --- a/docs/ko/docs/tutorial/body-multiple-params.md +++ b/docs/ko/docs/tutorial/body-multiple-params.md @@ -19,7 +19,7 @@ ## λ€μ€ λ³Έλ¬Έ 맀κ°λ³μ -μ΄μ μμ μμ 보λ―μ΄, *κ²½λ‘ λμ*μ μλμ κ°μ΄ `Item` μμ±μ κ°μ§ JSON λ³Έλ¬Έμ μμν©λλ€: +μ΄μ μμ μμ 보λ―μ΄, *κ²½λ‘ μλ*μ μλμ κ°μ΄ `Item` μμ±μ κ°μ§ JSON λ³Έλ¬Έμ μμν©λλ€: ```JSON { @@ -161,9 +161,9 @@ item: Item = Body(..., embed=True) ## μ 리 -μμ²μ΄ λ¨ νκ°μ λ³Έλ¬Έμ κ°μ§κ³ μλλΌλ, *κ²½λ‘ λμ ν¨μ*λ‘ λ€μ€ λ³Έλ¬Έ 맀κ°λ³μλ₯Ό μΆκ°ν μ μμ΅λλ€. +μμ²μ΄ λ¨ νκ°μ λ³Έλ¬Έμ κ°μ§κ³ μλλΌλ, *κ²½λ‘ μλ ν¨μ*λ‘ λ€μ€ λ³Έλ¬Έ 맀κ°λ³μλ₯Ό μΆκ°ν μ μμ΅λλ€. -νμ§λ§, **FastAPI**λ μ΄λ₯Ό μ²λ¦¬νκ³ , ν¨μμ μ¬λ°λ₯Έ λ°μ΄ν°λ₯Ό μ 곡νλ©°, *κ²½λ‘ λμ*μΌλ‘ μ¬λ°λ₯Έ μ€ν€λ§λ₯Ό κ²μ¦νκ³ λ¬Έμν ν©λλ€. +νμ§λ§, **FastAPI**λ μ΄λ₯Ό μ²λ¦¬νκ³ , ν¨μμ μ¬λ°λ₯Έ λ°μ΄ν°λ₯Ό μ 곡νλ©°, *κ²½λ‘ μλ*μΌλ‘ μ¬λ°λ₯Έ μ€ν€λ§λ₯Ό κ²μ¦νκ³ λ¬Έμν ν©λλ€. λν, λ¨μΌ κ°μ λ³Έλ¬Έμ μΌλΆλ‘ λ°λλ‘ μ μΈν μ μμ΅λλ€. diff --git a/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md b/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md index bbf3a8283..38cdc2e1a 100644 --- a/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md +++ b/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md @@ -71,9 +71,9 @@ fluffy = Cat(name="Mr Fluffy") FastAPIκ° μ€μ§μ μΌλ‘ νμΈνλ κ²μ "νΈμΆ κ°λ₯μ±"(ν¨μ, ν΄λμ€ λλ λ€λ₯Έ λͺ¨λ κ²)κ³Ό μ μλ 맀κ°λ³μλ€μ λλ€. -"νΈμΆ κ°λ₯"ν κ²μ μμ‘΄μ±μΌλ‘μ **FastAPI**μ μ λ¬νλ©΄, κ·Έ "νΈμΆ κ°λ₯"ν κ²μ 맀κ°λ³μλ€μ λΆμν ν μ΄λ₯Ό *κ²½λ‘ λμ ν¨μ*λ₯Ό μν 맀κ°λ³μμ λμΌν λ°©μμΌλ‘ μ²λ¦¬ν©λλ€. νμ-μμ‘΄μ± λν κ°μ λ°©μμΌλ‘ μ²λ¦¬ν©λλ€. +"νΈμΆ κ°λ₯"ν κ²μ μμ‘΄μ±μΌλ‘μ **FastAPI**μ μ λ¬νλ©΄, κ·Έ "νΈμΆ κ°λ₯"ν κ²μ 맀κ°λ³μλ€μ λΆμν ν μ΄λ₯Ό *κ²½λ‘ μλ ν¨μ*λ₯Ό μν 맀κ°λ³μμ λμΌν λ°©μμΌλ‘ μ²λ¦¬ν©λλ€. νμ-μμ‘΄μ± λν κ°μ λ°©μμΌλ‘ μ²λ¦¬ν©λλ€. -맀κ°λ³μκ° μλ "νΈμΆ κ°λ₯"ν κ² μμ 맀κ°λ³μκ° μλ *κ²½λ‘ λμ ν¨μ*μ λμΌν λ°©μμΌλ‘ μ μ©λ©λλ€. +맀κ°λ³μκ° μλ "νΈμΆ κ°λ₯"ν κ² μμ 맀κ°λ³μκ° μλ *κ²½λ‘ μλ ν¨μ*μ λμΌν λ°©μμΌλ‘ μ μ©λ©λλ€. κ·Έλμ, μ°λ¦¬λ μ μμ μμμ `common_paramenters` μμ‘΄μ±μ ν΄λμ€ `CommonQueryParams`λ‘ λ°κΏ μ μμ΅λλ€. diff --git a/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md b/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md new file mode 100644 index 000000000..92b2c7d1c --- /dev/null +++ b/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md @@ -0,0 +1,139 @@ +# κ²½λ‘ μλ λ°μ½λ μ΄ν°μμμ μμ‘΄μ± + +λͺλͺ κ²½μ°μλ, *κ²½λ‘ μλ ν¨μ* μμμ μμ‘΄μ±μ λ°ν κ°μ΄ νμνμ§ μμ΅λλ€. + +λλ μμ‘΄μ±μ΄ κ°μ λ°ννμ§ μμ΅λλ€. + +κ·Έλ¬λ μ¬μ ν μ€ν/ν΄κ²°λ νμκ° μμ΅λλ€. + +κ·Έλ° κ²½μ°μ, `Depends`λ₯Ό μ¬μ©νμ¬ *κ²½λ‘ μλ ν¨μ*μ 맀κ°λ³μλ‘ μ μΈνλ κ²λ³΄λ€ *κ²½λ‘ μλ λ°μ½λ μ΄ν°*μ `dependencies`μ `list`λ₯Ό μΆκ°ν μ μμ΅λλ€. + +## *κ²½λ‘ μλ λ°μ½λ μ΄ν°*μ `dependencies` μΆκ°νκΈ° + +*κ²½λ‘ μλ λ°μ½λ μ΄ν°*λ `dependencies`λΌλ μ νμ μΈ μΈμλ₯Ό λ°μ΅λλ€. + +`Depends()`λ‘ λ `list`μ΄μ΄μΌν©λλ€: + +=== "Python 3.9+" + + ```Python hl_lines="19" + {!> ../../../docs_src/dependencies/tutorial006_an_py39.py!} + ``` + +=== "Python 3.8+" + + ```Python hl_lines="18" + {!> ../../../docs_src/dependencies/tutorial006_an.py!} + ``` + +=== "Python 3.8 Annotatedκ° μλ κ²½μ°" + + !!! tip "ν" + κ°λ₯νλ€λ©΄ `Annotated`κ° λ¬λ¦° λ²μ μ κΆμ₯ν©λλ€. + + ```Python hl_lines="17" + {!> ../../../docs_src/dependencies/tutorial006.py!} + ``` + +μ΄λ¬ν μμ‘΄μ±λ€μ κΈ°μ‘΄ μμ‘΄μ±λ€κ³Ό κ°μ λ°©μμΌλ‘ μ€ν/ν΄κ²°λ©λλ€. κ·Έλ¬λ κ°μ (무μμ΄λ λ°ννλ€λ©΄) *κ²½λ‘ μλ ν¨μ*μ μ 곡λμ§ μμ΅λλ€. + +!!! tip "ν" + μΌλΆ νΈμ§κΈ°μμλ μ¬μ©λμ§ μλ ν¨μ 맀κ°λ³μλ₯Ό κ²μ¬νκ³ μ€λ₯λ‘ νμν©λλ€. + + *κ²½λ‘ μλ λ°μ½λ μ΄ν°*μμ `dependencies`λ₯Ό μ¬μ©νλ©΄ νΈμ§κΈ°/λꡬ μ€λ₯λ₯Ό νΌνλ©° μ€νλλλ‘ ν μ μμ΅λλ€. + + λν μ½λμμ μ¬μ©λμ§ μλ 맀κ°λ³μλ₯Ό λ³΄κ³ λΆνμνλ€κ³ μκ°ν μ μλ μλ‘μ΄ κ°λ°μμ νΌλμ λ°©μ§νλλ° λμμ΄ λ μ μμ΅λλ€. + +!!! info "μ 보" + μ΄ μμμμ `X-Key`μ `X-Token`μ΄λΌλ 컀μ€ν ν€λλ₯Ό λ§λ€μ΄ μ¬μ©νμ΅λλ€. + + κ·Έλ¬λ μ€μ λ‘ λ³΄μμ ꡬνν λλ ν΅ν©λ [보μ μ νΈλ¦¬ν° (λ€μ μ±ν°)](../security/index.md){.internal-link target=_blank}λ₯Ό μ¬μ©νλ κ²μ΄ λ λ§μ μ΄μ μ μ»μ μ μμ΅λλ€. + +## μμ‘΄μ± μ€λ₯μ κ° λ°ννκΈ° + +νμμ μ¬μ©νλλλ‘ κ°μ μμ‘΄μ± *ν¨μ*λ₯Ό μ¬μ©ν μ μμ΅λλ€. + +### μμ‘΄μ± μꡬμ¬ν + +(ν€λκ°μ) μμ² μꡬμ¬νμ΄λ νμ-μμ‘΄μ±μ μ μΈν μ μμ΅λλ€: + +=== "Python 3.9+" + + ```Python hl_lines="8 13" + {!> ../../../docs_src/dependencies/tutorial006_an_py39.py!} + ``` + +=== "Python 3.8+" + + ```Python hl_lines="7 12" + {!> ../../../docs_src/dependencies/tutorial006_an.py!} + ``` + +=== "Python 3.8 Annotatedκ° μλ κ²½μ°" + + !!! tip "ν" + κ°λ₯νλ€λ©΄ `Annotated`κ° λ¬λ¦° λ²μ μ κΆμ₯ν©λλ€. + + ```Python hl_lines="6 11" + {!> ../../../docs_src/dependencies/tutorial006.py!} + ``` + +### μ€λ₯ λ°μμν€κΈ° + +λ€μ μμ‘΄μ±μ κΈ°μ‘΄ μμ‘΄μ±κ³Ό λμΌνκ² μμΈλ₯Ό `raise`λ₯Ό μΌμΌν¬ μ μμ΅λλ€: + +=== "Python 3.9+" + + ```Python hl_lines="10 15" + {!> ../../../docs_src/dependencies/tutorial006_an_py39.py!} + ``` + +=== "Python 3.8+" + + ```Python hl_lines="9 14" + {!> ../../../docs_src/dependencies/tutorial006_an.py!} + ``` + +=== "Python 3.8 Annotatedκ° μλ κ²½μ°" + + !!! tip "ν" + κ°λ₯νλ€λ©΄ `Annotated`κ° λ¬λ¦° λ²μ μ κΆμ₯ν©λλ€. + + ```Python hl_lines="8 13" + {!> ../../../docs_src/dependencies/tutorial006.py!} + ``` + +### κ° λ°ννκΈ° + +κ°μ λ°ννκ±°λ, κ·Έλ¬μ§ μμ μ μμΌλ©° κ°μ μ¬μ©λμ§ μμ΅λλ€. + +κ·Έλμ μ΄λ―Έ λ€λ₯Έ κ³³μμ μ¬μ©λ (κ°μ λ°ννλ) μΌλ°μ μΈ μμ‘΄μ±μ μ¬μ¬μ©ν μ μκ³ , λΉλ‘ κ°μ μ¬μ©λμ§ μμ§λ§ μμ‘΄μ±μ μ€νλ κ²μ λλ€: + +=== "Python 3.9+" + + ```Python hl_lines="11 16" + {!> ../../../docs_src/dependencies/tutorial006_an_py39.py!} + ``` + +=== "Python 3.8+" + + ```Python hl_lines="10 15" + {!> ../../../docs_src/dependencies/tutorial006_an.py!} + ``` + +=== "Python 3.8 Annotatedκ° μλ κ²½μ°" + + !!! tip "ν" + κ°λ₯νλ€λ©΄ `Annotated`κ° λ¬λ¦° λ²μ μ κΆμ₯ν©λλ€. + + ```Python hl_lines="9 14" + {!> ../../../docs_src/dependencies/tutorial006.py!} + ``` + +## *κ²½λ‘ μλ* λͺ¨μμ λν μμ‘΄μ± + +λμ€μ μ¬λ¬ νμΌμ κ°μ§κ³ μμ μ μλ λ ν° μ ν리μΌμ΄μ μ ꡬ쑰ννλ λ²([λ ν° μ ν리μΌμ΄μ - μ¬λ¬ νμΌλ€](../../tutorial/bigger-applications.md){.internal-link target=_blank})μ μ½μ λ, *κ²½λ‘ μλ* λͺ¨μμ λν λ¨μΌ `dependencies` 맀κ°λ³μλ₯Ό μ μΈνλ λ²μ λν΄μ λ°°μ°κ² λ κ²μ λλ€. + +## μ μ μμ‘΄μ± + +λ€μμΌλ‘ κ° *κ²½λ‘ μλ*μ μ μ©λλλ‘ `FastAPI` μ ν리μΌμ΄μ μ 체μ μμ‘΄μ±μ μΆκ°νλ λ²μ λ³Ό κ²μ λλ€. diff --git a/docs/ko/docs/tutorial/dependencies/global-dependencies.md b/docs/ko/docs/tutorial/dependencies/global-dependencies.md new file mode 100644 index 000000000..930f6e678 --- /dev/null +++ b/docs/ko/docs/tutorial/dependencies/global-dependencies.md @@ -0,0 +1,34 @@ +# μ μ μμ‘΄μ± + +λͺλͺ μ ν리μΌμ΄μ μμλ μ ν리μΌμ΄μ μ 체μ μμ‘΄μ±μ μΆκ°νκ³ μΆμ μ μμ΅λλ€. + +[*κ²½λ‘ μλ λ°μ½λ μ΄ν°*μ `dependencies` μΆκ°νκΈ°](dependencies-in-path-operation-decorators.md){.internal-link target=_blank}μ μ μ¬ν λ°©λ²μΌλ‘ `FastAPI` μ ν리μΌμ΄μ μ κ·Έκ²λ€μ μΆκ°ν μ μμ΅λλ€. + +κ·Έλ° κ²½μ°μ, μ ν리μΌμ΄μ μ λͺ¨λ *κ²½λ‘ μλ*μ μ μ©λ κ²μ λλ€: + +=== "Python 3.9+" + + ```Python hl_lines="16" + {!> ../../../docs_src/dependencies/tutorial012_an_py39.py!} + ``` + +=== "Python 3.8+" + + ```Python hl_lines="16" + {!> ../../../docs_src/dependencies/tutorial012_an.py!} + ``` + +=== "Python 3.8 Annotatedκ° μλ κ²½μ°" + + !!! tip "ν" + κ°λ₯νλ€λ©΄ `Annotated`κ° λ¬λ¦° λ²μ μ κΆμ₯ν©λλ€. + + ```Python hl_lines="15" + {!> ../../../docs_src/dependencies/tutorial012.py!} + ``` + +κ·Έλ¦¬κ³ [*κ²½λ‘ μλ λ°μ½λ μ΄ν°*μ `dependencies` μΆκ°νκΈ°](dependencies-in-path-operation-decorators.md){.internal-link target=_blank}μ λν μμ΄λμ΄λ μ¬μ ν μ μ©λμ§λ§ μ¬κΈ°μμλ μ±μ μλ λͺ¨λ *κ²½λ‘ μλ*μ μ μ©λ©λλ€. + +## *κ²½λ‘ μλ* λͺ¨μμ λν μμ‘΄μ± + +μ΄νμ μ¬λ¬ νμΌλ€μ κ°μ§λ λ ν° μ ν리μΌμ΄μ μ ꡬ쑰ννλ λ²([λ ν° μ ν리μΌμ΄μ - μ¬λ¬ νμΌλ€](../../tutorial/bigger-applications.md){.internal-link target=_blank})μ μ½μ λ, *κ²½λ‘ μλ* λͺ¨μμ λν λ¨μΌ `dependencies` 맀κ°λ³μλ₯Ό μ μΈνλ λ²μ λν΄μ λ°°μ°κ² λ κ²μ λλ€. diff --git a/docs/ko/docs/tutorial/dependencies/index.md b/docs/ko/docs/tutorial/dependencies/index.md index cde88eb6c..c56dddae3 100644 --- a/docs/ko/docs/tutorial/dependencies/index.md +++ b/docs/ko/docs/tutorial/dependencies/index.md @@ -6,7 +6,7 @@ ## "μμ‘΄μ± μ£Όμ "μ 무μμ λκΉ? -**"μμ‘΄μ± μ£Όμ "**μ νλ‘κ·Έλλ°μμ μ¬λ¬λΆμ μ½λ(μ΄ κ²½μ°, κ²½λ‘ λμ ν¨μ)κ° μλνκ³ μ¬μ©νλ λ° νμλ‘ νλ κ², μ¦ "μμ‘΄μ±"μ μ μΈν μ μλ λ°©λ²μ μλ―Έν©λλ€. +**"μμ‘΄μ± μ£Όμ "**μ νλ‘κ·Έλλ°μμ μ¬λ¬λΆμ μ½λ(μ΄ κ²½μ°, κ²½λ‘ μλ ν¨μ)κ° μλνκ³ μ¬μ©νλ λ° νμλ‘ νλ κ², μ¦ "μμ‘΄μ±"μ μ μΈν μ μλ λ°©λ²μ μλ―Έν©λλ€. κ·Έ νμ, μμ€ν (μ΄ κ²½μ° FastAPI)μ μ¬λ¬λΆμ μ½λκ° μꡬνλ μμ‘΄μ±μ μ 곡νκΈ° μν΄ νμν λͺ¨λ μμ μ μ²λ¦¬ν©λλ€.(μμ‘΄μ±μ "μ£Όμ "ν©λλ€) diff --git a/docs/ko/docs/tutorial/first-steps.md b/docs/ko/docs/tutorial/first-steps.md index 0eb4d6bd5..e3b42bce7 100644 --- a/docs/ko/docs/tutorial/first-steps.md +++ b/docs/ko/docs/tutorial/first-steps.md @@ -309,7 +309,7 @@ URL "`/`"μ λν `GET` μλμ μ¬μ©νλ μμ²μ λ°μ λλ§λ€ **Fa {!../../../docs_src/first_steps/tutorial003.py!} ``` -!!! note μ°Έκ³ +!!! note "μ°Έκ³ " μ°¨μ΄μ μ λͺ¨λ₯΄κ² λ€λ©΄ [Async: *"In a hurry?"*](../async.md#in-a-hurry){.internal-link target=_blank}μ νμΈνμΈμ. ### 5 λ¨κ³: μ½ν μΈ λ°ν diff --git a/docs/ko/docs/tutorial/path-operation-configuration.md b/docs/ko/docs/tutorial/path-operation-configuration.md index 22aad0421..411c43493 100644 --- a/docs/ko/docs/tutorial/path-operation-configuration.md +++ b/docs/ko/docs/tutorial/path-operation-configuration.md @@ -1,4 +1,4 @@ -# κ²½λ‘ λμ μ€μ +# κ²½λ‘ μλ μ€μ *κ²½λ‘ μλ λ°μ½λ μ΄ν°*λ₯Ό μ€μ νκΈ° μν΄μ μ λ¬ν μ μλ λͺ κ°μ§ 맀κ°λ³μκ° μμ΅λλ€. diff --git a/docs/ko/docs/tutorial/query-params-str-validations.md b/docs/ko/docs/tutorial/query-params-str-validations.md index 7ae100dcc..2e6396ccc 100644 --- a/docs/ko/docs/tutorial/query-params-str-validations.md +++ b/docs/ko/docs/tutorial/query-params-str-validations.md @@ -74,7 +74,7 @@ q: Optional[str] = None q: str = Query(None, max_length=50) ``` -μ΄λ λ°μ΄ν°λ₯Ό κ²μ¦ν κ²μ΄κ³ , λ°μ΄ν°κ° μ ν¨νμ§ μλ€λ©΄ λͺ λ°±ν μ€λ₯λ₯Ό 보μ¬μ£Όλ©°, OpenAPI μ€ν€λ§ *κ²½λ‘ λμ*μ 맀κ°λ³μλ₯Ό λ¬Έμν ν©λλ€. +μ΄λ λ°μ΄ν°λ₯Ό κ²μ¦ν κ²μ΄κ³ , λ°μ΄ν°κ° μ ν¨νμ§ μλ€λ©΄ λͺ λ°±ν μ€λ₯λ₯Ό 보μ¬μ£Όλ©°, OpenAPI μ€ν€λ§ *κ²½λ‘ μλ*μ 맀κ°λ³μλ₯Ό λ¬Έμν ν©λλ€. ## κ²μ¦ μΆκ° diff --git a/docs/ko/docs/tutorial/request-files.md b/docs/ko/docs/tutorial/request-files.md index decefe981..03a6d593a 100644 --- a/docs/ko/docs/tutorial/request-files.md +++ b/docs/ko/docs/tutorial/request-files.md @@ -108,7 +108,7 @@ HTMLμ νΌλ€(`
`)μ΄ μλ²μ λ°μ΄ν°λ₯Ό μ μ‘νλ λ°©μμ μΈμ½λ©κ³Ό νΌ νλμ λν΄ λ μκ³ μΆλ€λ©΄,POST
μ κ΄νMDNμΉ λ¬Έμ λ₯Ό μ°Έκ³ νκΈ° λ°λλλ€,.
-!!! warning "μ£Όμ"
+!!! warning "κ²½κ³ "
λ€μμ `File` κ³Ό `Form` 맀κ°λ³μλ₯Ό ν *κ²½λ‘ μλ*μ μ μΈνλ κ²μ΄ κ°λ₯νμ§λ§, μμ²μ λ³Έλ¬Έμ΄ `application/json` κ° μλ `multipart/form-data` λ‘ μΈμ½λ© λκΈ° λλ¬Έμ JSONμΌλ‘ λ°μμΌνλ `Body` νλλ₯Ό ν¨κ» μ μΈν μλ μμ΅λλ€.
μ΄λ **FastAPI**μ νκ³κ° μλλΌ, HTTP νλ‘ν μ½μ μν κ²μ
λλ€.
diff --git a/docs/ko/docs/tutorial/request-forms-and-files.md b/docs/ko/docs/tutorial/request-forms-and-files.md
index ddf232e7f..fdf8dbad0 100644
--- a/docs/ko/docs/tutorial/request-forms-and-files.md
+++ b/docs/ko/docs/tutorial/request-forms-and-files.md
@@ -25,7 +25,7 @@
μ΄λ€ νμΌλ€μ `bytes`λ‘, λ μ΄λ€ νμΌλ€μ `UploadFile`λ‘ μ μΈν μ μμ΅λλ€.
-!!! warning "μ£Όμ"
+!!! warning "κ²½κ³ "
λ€μμ `File`κ³Ό `Form` 맀κ°λ³μλ₯Ό ν *κ²½λ‘ μλ*μ μ μΈνλ κ²μ΄ κ°λ₯νμ§λ§, μμ²μ λ³Έλ¬Έμ΄ `application/json`κ° μλ `multipart/form-data`λ‘ μΈμ½λ© λκΈ° λλ¬Έμ JSONμΌλ‘ λ°μμΌνλ `Body` νλλ₯Ό ν¨κ» μ μΈν μλ μμ΅λλ€.
μ΄λ **FastAPI**μ νκ³κ° μλλΌ, HTTP νλ‘ν μ½μ μν κ²μ
λλ€.
diff --git a/docs/ko/docs/tutorial/response-model.md b/docs/ko/docs/tutorial/response-model.md
index fa90c10ae..0c9d5c16e 100644
--- a/docs/ko/docs/tutorial/response-model.md
+++ b/docs/ko/docs/tutorial/response-model.md
@@ -1,6 +1,6 @@
# μλ΅ λͺ¨λΈ
-μ΄λ€ *κ²½λ‘ λμ*μ΄λ 맀κ°λ³μ `response_model`λ₯Ό μ¬μ©νμ¬ μλ΅μ μν λͺ¨λΈμ μ μΈν μ μμ΅λλ€:
+μ΄λ€ *κ²½λ‘ μλ*μ΄λ 맀κ°λ³μ `response_model`λ₯Ό μ¬μ©νμ¬ μλ΅μ μν λͺ¨λΈμ μ μΈν μ μμ΅λλ€:
* `@app.get()`
* `@app.post()`
@@ -13,7 +13,7 @@
```
!!! note "μ°Έκ³ "
- `response_model`μ "λ°μ½λ μ΄ν°" λ©μλ(`get`, `post`, λ±)μ 맀κ°λ³μμ
λλ€. λͺ¨λ 맀κ°λ³μλ€κ³Ό λ³Έλ¬Έ(body)μ²λΌ *κ²½λ‘ λμ ν¨μ*κ° μλλλ€.
+ `response_model`μ "λ°μ½λ μ΄ν°" λ©μλ(`get`, `post`, λ±)μ 맀κ°λ³μμ
λλ€. λͺ¨λ 맀κ°λ³μλ€κ³Ό λ³Έλ¬Έ(body)μ²λΌ *κ²½λ‘ μλ ν¨μ*κ° μλλλ€.
Pydantic λͺ¨λΈ μ΄νΈλ¦¬λ·°νΈλ₯Ό μ μΈν κ²κ³Ό λμΌν νμ
μ μμ νλ―λ‘ Pydantic λͺ¨λΈμ΄ λ μ μμ§λ§, `List[Item]`κ³Ό κ°μ΄ Pydantic λͺ¨λΈλ€μ `list`μΌ μλ μμ΅λλ€.
@@ -21,7 +21,7 @@ FastAPIλ μ΄ `response_model`λ₯Ό μ¬μ©νμ¬:
* μΆλ ₯ λ°μ΄ν°λ₯Ό νμ
μ μΈμΌλ‘ λ³ν.
* λ°μ΄ν° κ²μ¦.
-* OpenAPI *κ²½λ‘ λμ*μ μλ΅μ JSON μ€ν€λ§ μΆκ°.
+* OpenAPI *κ²½λ‘ μλ*μ μλ΅μ JSON μ€ν€λ§ μΆκ°.
* μλ μμ± λ¬Έμ μμ€ν
μ μ¬μ©.
νμ§λ§ κ°μ₯ μ€μν κ²μ:
@@ -49,7 +49,7 @@ FastAPIλ μ΄ `response_model`λ₯Ό μ¬μ©νμ¬:
μ΄ κ²½μ°, μ¬μ©μκ° μ€μ€λ‘ λΉλ°λ²νΈλ₯Ό λ°μ νκΈ° λλ¬Έμ λ¬Έμ κ° λμ§ μμ μ μμ΅λλ€.
-κ·Έλ¬λ λμΌν λͺ¨λΈμ λ€λ₯Έ *κ²½λ‘ λμ*μμ μ¬μ©ν κ²½μ°, λͺ¨λ ν΄λΌμ΄μΈνΈμκ² μ¬μ©μμ λΉλ°λ²νΈλ₯Ό λ°μ ν μ μμ΅λλ€.
+κ·Έλ¬λ λμΌν λͺ¨λΈμ λ€λ₯Έ *κ²½λ‘ μλ*μμ μ¬μ©ν κ²½μ°, λͺ¨λ ν΄λΌμ΄μΈνΈμκ² μ¬μ©μμ λΉλ°λ²νΈλ₯Ό λ°μ ν μ μμ΅λλ€.
!!! danger "μν"
μ λλ‘ μ¬μ©μμ νλ¬Έ λΉλ°λ²νΈλ₯Ό μ μ₯νκ±°λ μλ΅μΌλ‘ λ°μ νμ§ λ§μμμ€.
@@ -62,7 +62,7 @@ FastAPIλ μ΄ `response_model`λ₯Ό μ¬μ©νμ¬:
{!../../../docs_src/response_model/tutorial003.py!}
```
-μ¬κΈ°μ *κ²½λ‘ λμ ν¨μ*κ° λΉλ°λ²νΈλ₯Ό ν¬ν¨νλ λμΌν μ
λ ₯ μ¬μ©μλ₯Ό λ°νν μ§λΌλ:
+μ¬κΈ°μ *κ²½λ‘ μλ ν¨μ*κ° λΉλ°λ²νΈλ₯Ό ν¬ν¨νλ λμΌν μ
λ ₯ μ¬μ©μλ₯Ό λ°νν μ§λΌλ:
```Python hl_lines="24"
{!../../../docs_src/response_model/tutorial003.py!}
@@ -104,7 +104,7 @@ FastAPIλ μ΄ `response_model`λ₯Ό μ¬μ©νμ¬:
### `response_model_exclude_unset` 맀κ°λ³μ μ¬μ©
-*κ²½λ‘ λμ λ°μ½λ μ΄ν°* 맀κ°λ³μλ₯Ό `response_model_exclude_unset=True`λ‘ μ€μ ν μ μμ΅λλ€:
+*κ²½λ‘ μλ λ°μ½λ μ΄ν°* 맀κ°λ³μλ₯Ό `response_model_exclude_unset=True`λ‘ μ€μ ν μ μμ΅λλ€:
```Python hl_lines="24"
{!../../../docs_src/response_model/tutorial004.py!}
@@ -112,7 +112,7 @@ FastAPIλ μ΄ `response_model`λ₯Ό μ¬μ©νμ¬:
μ΄λ¬ν κΈ°λ³Έκ°μ μλ΅μ ν¬ν¨λμ§ μκ³ μ€μ λ‘ μ€μ λ κ°λ§ ν¬ν¨λ©λλ€.
-λ°λΌμ ν΄λΉ *κ²½λ‘ λμ*μ IDκ° `foo`μΈ νλͺ©(items)μ μμ²μΌλ‘ 보λ΄λ©΄ (κΈ°λ³Έκ°μ μ μΈν) μλ΅μ λ€μκ³Ό κ°μ΅λλ€:
+λ°λΌμ ν΄λΉ *κ²½λ‘ μλ*μ IDκ° `foo`μΈ νλͺ©(items)μ μμ²μΌλ‘ 보λ΄λ©΄ (κΈ°λ³Έκ°μ μ μΈν) μλ΅μ λ€μκ³Ό κ°μ΅λλ€:
```JSON
{
@@ -173,7 +173,7 @@ IDκ° `baz`μΈ νλͺ©(items)μ²λΌ κΈ°λ³Έκ°κ³Ό λμΌν κ°μ κ°λλ€λ©΄:
### `response_model_include` λ° `response_model_exclude`
-*κ²½λ‘ λμ λ°μ½λ μ΄ν°* 맀κ°λ³μ `response_model_include` λ° `response_model_exclude`λ₯Ό μ¬μ©ν μ μμ΅λλ€.
+*κ²½λ‘ μλ λ°μ½λ μ΄ν°* 맀κ°λ³μ `response_model_include` λ° `response_model_exclude`λ₯Ό μ¬μ©ν μ μμ΅λλ€.
μ΄λ€μ ν¬ν¨(λλ¨Έμ§ μλ΅)νκ±°λ μ μΈ(λλ¨Έμ§ ν¬ν¨) ν μ΄νΈλ¦¬λ·°νΈμ μ΄λ¦κ³Ό `str`μ `set`μ λ°μ΅λλ€.
@@ -205,6 +205,6 @@ Pydantic λͺ¨λΈμ΄ νλλ§ μκ³ μΆλ ₯μμ ββμΌλΆ λ°μ΄ν°λ₯Ό μ
## μμ½
-μλ΅ λͺ¨λΈμ μ μνκ³ κ°μΈμ λ³΄κ° νν°λλ κ²μ 보μ₯νκΈ° μν΄ *κ²½λ‘ λμ λ°μ½λ μ΄ν°*μ 맀κ°λ³μ `response_model`μ μ¬μ©νμΈμ.
+μλ΅ λͺ¨λΈμ μ μνκ³ κ°μΈμ λ³΄κ° νν°λλ κ²μ 보μ₯νκΈ° μν΄ *κ²½λ‘ μλ λ°μ½λ μ΄ν°*μ 맀κ°λ³μ `response_model`μ μ¬μ©νμΈμ.
λͺ
μμ μΌλ‘ μ€μ λ κ°λ§ λ°ννλ €λ©΄ `response_model_exclude_unset`μ μ¬μ©νμΈμ.
diff --git a/docs/ko/docs/tutorial/security/get-current-user.md b/docs/ko/docs/tutorial/security/get-current-user.md
index ce944b16d..5bc2cee7a 100644
--- a/docs/ko/docs/tutorial/security/get-current-user.md
+++ b/docs/ko/docs/tutorial/security/get-current-user.md
@@ -36,7 +36,7 @@ Pydanticμ μ¬μ©νμ¬ λ³Έλ¬Έμ μ μΈνλ κ²κ³Ό κ°μ λ°©μμΌλ‘ λ€
`get_current_user`λ μ΄μ μ μμ±ν κ²κ³Ό λμΌν `oauth2_scheme`κ³Ό μ’
μμ±μ κ°κ² λ©λλ€.
-μ΄μ μ *κ²½λ‘ λμ*μμ μ§μ μννλ κ²κ³Ό λμΌνκ² μ μ’
μμ± `get_current_user`λ νμ μ’
μμ± `oauth2_scheme`μμ `str`λ‘ `token`μ μμ ν©λλ€.
+μ΄μ μ *κ²½λ‘ μλ*μμ μ§μ μννλ κ²κ³Ό λμΌνκ² μ μ’
μμ± `get_current_user`λ νμ μ’
μμ± `oauth2_scheme`μμ `str`λ‘ `token`μ μμ ν©λλ€.
=== "νμ΄μ¬ 3.7 μ΄μ"