Browse Source

๐ŸŒ Add Korean translation for `docs/ko/docs/tutorial/query-param-models.md` (#12940)

pull/12974/head
timothy 5 months ago
committed by GitHub
parent
commit
835b6465d9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 68
      docs/ko/docs/tutorial/query-param-models.md

68
docs/ko/docs/tutorial/query-param-models.md

@ -0,0 +1,68 @@
# ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜ ๋ชจ๋ธ
์—ฐ๊ด€๋œ ์ฟผ๋ฆฌ **๋งค๊ฐœ๋ณ€์ˆ˜** ๊ทธ๋ฃน์ด ์žˆ๋‹ค๋ฉด **Pydantic ๋ชจ๋ธ** ์„ ์‚ฌ์šฉํ•ด ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ด๋ ‡๊ฒŒ ํ•˜๋ฉด **์—ฌ๋Ÿฌ ๊ณณ**์—์„œ **๋ชจ๋ธ์„ ์žฌ์‚ฌ์šฉ**ํ•  ์ˆ˜ ์žˆ์„ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, ๋งค๊ฐœ๋ณ€์ˆ˜์— ๋Œ€ํ•œ ๊ฒ€์ฆ ๋ฐ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋„ ํ•œ ๋ฒˆ์— ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜Ž
/// note | ์ฐธ๊ณ 
์ด ๊ธฐ๋Šฅ์€ FastAPI ๋ฒ„์ „ `0.115.0`๋ถ€ํ„ฐ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ๐Ÿค“
///
## ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜์™€ Pydantic ๋ชจ๋ธ
ํ•„์š”ํ•œ **์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜**๋ฅผ **Pydantic ๋ชจ๋ธ** ์•ˆ์— ์„ ์–ธํ•œ ๋‹ค์Œ, ๋ชจ๋ธ์„ `Query`๋กœ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค.
{* ../../docs_src/query_param_models/tutorial001_an_py310.py hl[9:13,17] *}
**FastAPI**๋Š” ์š”์ฒญ์˜ **์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜**์—์„œ **๊ฐ ํ•„๋“œ**์˜ ๋ฐ์ดํ„ฐ๋ฅผ **์ถ”์ถœ**ํ•ด ์ •์˜ํ•œ Pydantic ๋ชจ๋ธ๋กœ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
## ๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ
`/docs` ๊ฒฝ๋กœ์˜ API ๋ฌธ์„œ์—์„œ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
<div class="screenshot">
<img src="/img/tutorial/query-param-models/image01.png">
</div>
## ์ถ”๊ฐ€ ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜ ๊ธˆ์ง€
๋ช‡๋ช‡์˜ ํŠน์ดํ•œ ๊ฒฝ์šฐ์— (ํ”์น˜ ์•Š์ง€๋งŒ), ํ—ˆ์šฉํ•  ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ **์ œํ•œ**ํ•ด์•ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Pydantic ๋ชจ๋ธ ์„ค์ •์—์„œ `extra` ํ•„๋“œ๋ฅผ `forbid` ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
{* ../../docs_src/query_param_models/tutorial002_an_py310.py hl[10] *}
๋งŒ์•ฝ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ **์ถ”๊ฐ€์ ์ธ** ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ด๋ ค๊ณ  ํ•˜๋ฉด, ํด๋ผ์ด์–ธํŠธ๋Š” **์—๋Ÿฌ** ์‘๋‹ต์„ ๋ฐ›๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
์˜ˆ๋ฅผ ๋“ค์–ด, ์•„๋ž˜์™€ ๊ฐ™์ด ๋งŒ์•ฝ ํด๋ผ์ด์–ธํŠธ๊ฐ€ `tool` ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜์— `plumbus` ๋ผ๋Š” ๊ฐ’์„ ์ถ”๊ฐ€ํ•ด์„œ ๋ณด๋‚ด๋ ค๊ณ  ํ•˜๋ฉด,
```http
https://example.com/items/?limit=10&tool=plumbus
```
ํด๋ผ์ด์–ธํŠธ๋Š” ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜ `tool` ์ด ํ—ˆ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” **์—๋Ÿฌ** ์‘๋‹ต์„ ๋ฐ›๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
```json
{
"detail": [
{
"type": "extra_forbidden",
"loc": ["query", "tool"],
"msg": "Extra inputs are not permitted",
"input": "plumbus"
}
]
}
```
## ์š”์•ฝ
**FastAPI** ์—์„œ **์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜** ๋ฅผ ์„ ์–ธํ•  ๋•Œ **Pydantic ๋ชจ๋ธ** ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜Ž
/// tip | ํŒ
์Šคํฌ์ผ๋Ÿฌ ๊ฒฝ๊ณ : Pydantic ๋ชจ๋ธ์„ ์ฟ ํ‚ค์™€ ํ—ค๋”์—๋„ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด์— ๋Œ€ํ•ด์„œ๋Š” ์ดํ›„ ํŠœํ† ๋ฆฌ์–ผ์—์„œ ๋‹ค๋ฃฐ ์˜ˆ์ •์ž…๋‹ˆ๋‹ค. ๐Ÿคซ
///
Loadingโ€ฆ
Cancel
Save