Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

📝 Update includes indocs/ru/docs/tutorial/query-param-models.md#12994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tiangolo merged 1 commit intomasterfromincludes/query-params-models
Dec 9, 2024
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 2 additions & 130 deletionsdocs/ru/docs/tutorial/query-param-models.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,71 +14,7 @@

Объявите нужные **query-параметры** в **Pydantic-модели**, а после аннотируйте параметр как `Query`:

//// tab | Python 3.10+

```Python hl_lines="9-13 17"
{!> ../../docs_src/query_param_models/tutorial001_an_py310.py!}
```

////

//// tab | Python 3.9+

```Python hl_lines="8-12 16"
{!> ../../docs_src/query_param_models/tutorial001_an_py39.py!}
```

////

//// tab | Python 3.8+

```Python hl_lines="10-14 18"
{!> ../../docs_src/query_param_models/tutorial001_an.py!}
```

////

//// tab | Python 3.10+ без Annotated

/// tip | Совет

При возможности используйте версию с `Annotated`.

///

```Python hl_lines="9-13 17"
{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
```

////

//// tab | Python 3.9+ без Annotated

/// tip | Совет

При возможности используйте версию с `Annotated`.

///

```Python hl_lines="8-12 16"
{!> ../../docs_src/query_param_models/tutorial001_py39.py!}
```

////

//// tab | Python 3.8+ без Annotated

/// tip | Совет

При возможности используйте версию с `Annotated`.

///

```Python hl_lines="9-13 17"
{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
```

////
{* ../../docs_src/query_param_models/tutorial001_an_py310.py hl[9:13,17] *}

**FastAPI извлечёт** данные соответствующие **каждому полю модели** из **query-параметров** запроса и выдаст вам объявленную Pydantic-модель заполненную ими.

Expand All@@ -96,71 +32,7 @@

Вы можете сконфигурировать Pydantic-модель так, чтобы запретить (`forbid`) все дополнительные (`extra`) поля.

//// tab | Python 3.10+

```Python hl_lines="10"
{!> ../../docs_src/query_param_models/tutorial002_an_py310.py!}
```

////

//// tab | Python 3.9+

```Python hl_lines="9"
{!> ../../docs_src/query_param_models/tutorial002_an_py39.py!}
```

////

//// tab | Python 3.8+

```Python hl_lines="11"
{!> ../../docs_src/query_param_models/tutorial002_an.py!}
```

////

//// tab | Python 3.10+ без Annotated

/// tip | Совет

При возможности используйте версию с `Annotated`.

///

```Python hl_lines="10"
{!> ../../docs_src/query_param_models/tutorial002_py310.py!}
```

////

//// tab | Python 3.9+ без Annotated

/// tip | Совет

При возможности используйте версию с `Annotated`.

///

```Python hl_lines="9"
{!> ../../docs_src/query_param_models/tutorial002_py39.py!}
```

////

//// tab | Python 3.8+ без Annotated

/// tip | Совет

При возможности используйте версию с `Annotated`.

///

```Python hl_lines="11"
{!> ../../docs_src/query_param_models/tutorial002.py!}
```

////
{* ../../docs_src/query_param_models/tutorial002_an_py310.py hl[10] *}

Если клиент попробует отправить **дополнительные** данные в **query-параметрах**, то в ответ он получит **ошибку**.

Expand Down

[8]ページ先頭

©2009-2026 Movatter.jp