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 이상"