|
|
@ -51,7 +51,7 @@ |
|
|
|
|
|
|
|
=== "Python 3.10+ Annotated๊ฐ ์๋ ๊ฒฝ์ฐ" |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
๊ฐ๋ฅํ๋ค๋ฉด `Annotated`๊ฐ ๋ฌ๋ฆฐ ๋ฒ์ ์ ๊ถ์ฅํฉ๋๋ค. |
|
|
|
|
|
|
|
```Python hl_lines="6-7" |
|
|
@ -60,7 +60,7 @@ |
|
|
|
|
|
|
|
=== "Python 3.8+ Annotated๊ฐ ์๋ ๊ฒฝ์ฐ" |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
๊ฐ๋ฅํ๋ค๋ฉด `Annotated`๊ฐ ๋ฌ๋ฆฐ ๋ฒ์ ์ ๊ถ์ฅํฉ๋๋ค. |
|
|
|
|
|
|
|
```Python hl_lines="8-11" |
|
|
@ -114,7 +114,7 @@ |
|
|
|
|
|
|
|
=== "Python 3.10+ Annotated๊ฐ ์๋ ๊ฒฝ์ฐ" |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
๊ฐ๋ฅํ๋ค๋ฉด `Annotated`๊ฐ ๋ฌ๋ฆฐ ๋ฒ์ ์ ๊ถ์ฅํฉ๋๋ค. |
|
|
|
|
|
|
|
```Python hl_lines="1" |
|
|
@ -123,7 +123,7 @@ |
|
|
|
|
|
|
|
=== "Python 3.8+ Annotated๊ฐ ์๋ ๊ฒฝ์ฐ" |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
๊ฐ๋ฅํ๋ค๋ฉด `Annotated`๊ฐ ๋ฌ๋ฆฐ ๋ฒ์ ์ ๊ถ์ฅํฉ๋๋ค. |
|
|
|
|
|
|
|
```Python hl_lines="3" |
|
|
@ -154,7 +154,7 @@ |
|
|
|
|
|
|
|
=== "Python 3.10+ Annotated๊ฐ ์๋ ๊ฒฝ์ฐ" |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
๊ฐ๋ฅํ๋ค๋ฉด `Annotated`๊ฐ ๋ฌ๋ฆฐ ๋ฒ์ ์ ๊ถ์ฅํฉ๋๋ค. |
|
|
|
|
|
|
|
```Python hl_lines="11 16" |
|
|
@ -163,7 +163,7 @@ |
|
|
|
|
|
|
|
=== "Python 3.8+ Annotated๊ฐ ์๋ ๊ฒฝ์ฐ" |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
๊ฐ๋ฅํ๋ค๋ฉด `Annotated`๊ฐ ๋ฌ๋ฆฐ ๋ฒ์ ์ ๊ถ์ฅํฉ๋๋ค. |
|
|
|
|
|
|
|
```Python hl_lines="15 20" |
|
|
@ -180,7 +180,7 @@ |
|
|
|
|
|
|
|
๊ทธ๋ฆฌ๊ณ ๊ทธ ํจ์๋ *๊ฒฝ๋ก ์๋ ํจ์*๊ฐ ์๋ํ๋ ๊ฒ๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๋งค๊ฐ๋ณ์๋ฅผ ๋ฐ์ต๋๋ค. |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
์ฌ๋ฌ๋ถ์ ๋ค์ ์ฅ์์ ํจ์๋ฅผ ์ ์ธํ๊ณ ์, "๋ค๋ฅธ ๊ฒ๋ค"์ด ์ด๋ป๊ฒ ์์กด์ฑ์ผ๋ก ์ฌ์ฉ๋๋์ง ์๊ฒ ๋ ๊ฒ์
๋๋ค. |
|
|
|
|
|
|
|
์๋ก์ด ์์ฒญ์ด ๋์ฐฉํ ๋๋ง๋ค, **FastAPI**๋ ๋ค์์ ์ฒ๋ฆฌํฉ๋๋ค: |
|
|
@ -202,7 +202,7 @@ common_parameters --> read_users |
|
|
|
|
|
|
|
์ด๋ ๊ฒ ํ๋ฉด ๊ณต์ฉ ์ฝ๋๋ฅผ ํ๋ฒ๋ง ์ ์ด๋ ๋๋ฉฐ, **FastAPI**๋ *๊ฒฝ๋ก ์๋*์ ์ํด ์ด์ ๋ํ ํธ์ถ์ ์ฒ๋ฆฌํฉ๋๋ค. |
|
|
|
|
|
|
|
!!! ํ์ธ |
|
|
|
!!! check "ํ์ธ" |
|
|
|
ํน๋ณํ ํด๋์ค๋ฅผ ๋ง๋ค์ง ์์๋ ๋๋ฉฐ, ์ด๋ฌํ ๊ฒ ํน์ ๋น์ทํ ์ข
๋ฅ๋ฅผ **FastAPI**์ "๋ฑ๋ก"ํ๊ธฐ ์ํด ์ด๋ค ๊ณณ์ ๋๊ฒจ์ฃผ์ง ์์๋ ๋ฉ๋๋ค. |
|
|
|
|
|
|
|
๋จ์ํ `Depends`์ ๋๊ฒจ์ฃผ๊ธฐ๋ง ํ๋ฉด ๋๋ฉฐ, **FastAPI**๋ ๋๋จธ์ง๋ฅผ ์ด์ฐํ ์ง ์๊ณ ์์ต๋๋ค. |
|
|
@ -237,7 +237,7 @@ commons: Annotated[dict, Depends(common_parameters)] |
|
|
|
{!> ../../../docs_src/dependencies/tutorial001_02_an.py!} |
|
|
|
``` |
|
|
|
|
|
|
|
!!! ํ |
|
|
|
!!! tip "ํ" |
|
|
|
์ด๋ ๊ทธ์ ํ์ค ํ์ด์ฌ์ด๊ณ "type alias"๋ผ๊ณ ๋ถ๋ฅด๋ฉฐ ์ฌ์ค **FastAPI**์ ๊ตญํ๋๋ ๊ฒ์ ์๋๋๋ค. |
|
|
|
|
|
|
|
ํ์ง๋ง, `Annotated`๋ฅผ ํฌํจํ์ฌ, **FastAPI**๊ฐ ํ์ด์ฌ ํ์ค์ ๊ธฐ๋ฐ์ผ๋ก ํ๊ณ ์๊ธฐ์, ์ด๋ฅผ ์ฌ๋ฌ๋ถ์ ์ฝ๋ ํธ๋ฆญ์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค. ๐ |
|
|
@ -256,7 +256,7 @@ commons: Annotated[dict, Depends(common_parameters)] |
|
|
|
|
|
|
|
์๋ฌด ๋ฌธ์ ์์ต๋๋ค. **FastAPI**๋ ๋ฌด์์ ํ ์ง ์๊ณ ์์ต๋๋ค. |
|
|
|
|
|
|
|
!!! ์ฐธ๊ณ |
|
|
|
!!! note "์ฐธ๊ณ " |
|
|
|
์ ๋ชจ๋ฅด์๊ฒ ๋ค๋ฉด, [Async: *"In a hurry?"*](../../async.md){.internal-link target=_blank} ๋ฌธ์์์ `async`์ `await`์ ๋ํด ํ์ธํ ์ ์์ต๋๋ค. |
|
|
|
|
|
|
|
## OpenAPI์ ํตํฉ |
|
|
|