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

🌐 Add Japanese translation fordocs/ja/docs/tutorial/response-model.md#1938

Merged
alejsdev merged 29 commits intofastapi:masterfrom
SwftAlpc:translation/ja-tutorial-response-model-md
Jan 15, 2024
Merged

🌐 Add Japanese translation fordocs/ja/docs/tutorial/response-model.md#1938
alejsdev merged 29 commits intofastapi:masterfrom
SwftAlpc:translation/ja-tutorial-response-model-md

Conversation

@SwftAlpc
Copy link
Contributor

@SwftAlpcSwftAlpc commentedAug 20, 2020
edited
Loading

This PR translates the tutorial/response-model.md to Japanese.
Please review tutorial/response-model.md.

Issue#1571 generates a new directory to support Japanese.
PR#1656 generates a new directory for tutorial.
I will fix dependency after#1571 &#1656 are merged.

ycd reacted with thumbs up emojiycd reacted with hooray emojiycd reacted with heart emojiycd reacted with rocket emoji
@SwftAlpcSwftAlpc mentioned this pull requestAug 20, 2020
@codecov
Copy link

codecovbot commentedAug 20, 2020
edited
Loading

Codecov Report

Merging#1938 intomaster willnot change coverage.
The diff coverage isn/a.

Impacted file tree graph

@@            Coverage Diff            @@##            master     #1938   +/-   ##=========================================  Coverage   100.00%   100.00%           =========================================  Files          239       239             Lines         7079      7079           =========================================  Hits          7079      7079

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatef495d98...f82f73d. Read thecomment docs.

@github-actions
Copy link
Contributor

📝 Docs preview for commit8182bcd at:https://5f3ecaa40cca8f755feb49fd--fastapi.netlify.app


ここでは`UserIn`モデルを宣言しています。それは平文のパスワードが含まれています:

```Python hl_lines="7 9"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="9 11"


そして、このモデルを使用して入力を宣言し、同じモデルを使って出力を宣言しています:

```Python hl_lines="15 16"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="17 18"


代わりに、平文のパスワードを持つ入力モデルと、パスワードを持たない出力モデルを作成することができます:

```Python hl_lines="7 9 14"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="9 11 16"


ここでは、*path operation関数*がパスワードを含む同じ入力ユーザーを返しているにもかかわらず:

```Python hl_lines="22"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="24"


...`response_model`を`UserOut`と宣言したことで、パスワードが含まれていません:

```Python hl_lines="20"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="22"


これは`response_model_include`や`response_mode_exclude`を使用していくつかの属性を省略しても、アプリケーションのOpenAPI(とドキュメント)で生成されたJSON Schemaが完全なモデルになるからです。

```Python hl_lines="29 35"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="31 37"


もし`set`を使用することを忘れて、代わりに`list`や`tuple`を使用しても、FastAPIはそれを`set`に変換して正しく動作します:

```Python hl_lines="29 35"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hl_lines="31 37"


## まとめ

*path operationデコレータの*`response_model`パラメータを使用して、レスポンスモデルを定義し、特にプライベートデータがフィルタリングされていることを確認します。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

path operationデコレータのresponse_modelパラメータを使用して、レスポンスモデルを定義し、特にプライベートデータがフィルタリングされていることを確認します。

@SwftAlpc
Copy link
ContributorAuthor

@tokusumi
Thanks for your review!
I fixed it.

@github-actions
Copy link
Contributor

📝 Docs preview for commitd99da75 at:https://5f4160a0442f8ee17ac9c500--fastapi.netlify.app

@tiangolotiangolo added awaiting-review lang-allTranslations lang-jaJapanese translations labelsAug 29, 2020
@github-actions
Copy link
Contributor

📝 Docs preview for commitbd47a16 at:https://5f4cbfa2b85066092143d2cc--fastapi.netlify.app

Copy link
Contributor

@Attsun1031Attsun1031 left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for your work 👍
Please check out some of the comments I made.

Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
SwftAlpcand others added10 commitsOctober 29, 2020 20:16
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
@github-actions
Copy link
Contributor

📝 Docs preview for commitf82f73d at:https://5f9aa66b8b8d8319b2fce839--fastapi.netlify.app

Copy link

@delhi09delhi09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It looks mostly good.
I pointed out some details.

* 出力データをモデルのデータに限定します。これがどのように重要なのか以下で見ていきましょう。

!!! note "技術詳細"
レスポンスモデルは、関数の戻り値のアノテーションではなく、このパラメータで宣言されています。なぜなら、パス関数は実際にはそのレスポンスモデルを返すのではなく、`dict`やデータベースオブジェクト、あるいは他のモデルを返し、`response_model`を使用してフィールドの制限やシリアライズを行うからです。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It may be a little better to modify "このパラメータ" to "関数のパラメータ" because it's a little hard for readers to undeastand what “この” refers to.

}
```

FastAPIは十分に賢いので(実際には、Pydanticが十分に賢い)`description`や`tax`、`tags`はデフォルト値と同じ値を持っているにもかかわらず、明示的に設定されていることを理解しています。(デフォルトから取得するのではなく)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's better to modify "デフォルトから取得するのではなく" to "デフォルトから取得されたのではなく" because " taken from" is the passive voice.


### `response_model_include`と`response_model_exclude`

*path operationデコレータ*として`response_model_include`と`response_model_exclude`も使用することができます。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's a little better to add "のパラメータ" after "path operationデコレータ".


*path operationデコレータ*として`response_model_include`と`response_model_exclude`も使用することができます。

属性名を持つ`str`の`set`を受け取り、含める(残りを省略する)か、除外(残りを含む)します。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think the following sentence is better .
「これらのパラメータは、含める(残りを省略する)もしくは除外(残りを含む)する対象の属性名のstrのsetを受け取ります。」

[理由]

  1. ベースの文は"They take a set of str"です。
  2. "str"に"with the name of the attributes"がかかっています。
  3. "attributes"に"to include (omitting the rest) or to exclude (including the rest)."がかかっています。("attributes"は"include","exclude"の目的語です。)

@tiangolotiangolo changed the titleAdd tutorial/response-model.md. Japanese ver.🌐 Add Japanese translation fordocs/ja/docs/tutorial/response-model.mdJun 26, 2023
@tiangolo
Copy link
Member

📝 Docs preview for commitb6e0d80 at:https://6499ca738f963504c47ce17f--fastapi.netlify.app

@alejsdev
Copy link
Member

Thanks@SwftAlpc 🤓

Thanks for the reviews@tokusumi@Attsun1031 ✌️

@alejsdevalejsdev merged commit5c71522 intofastapi:masterJan 15, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

3 more reviewers

@Attsun1031Attsun1031Attsun1031 left review comments

@delhi09delhi09delhi09 left review comments

@tokusumitokusumitokusumi approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

awaiting-reviewlang-allTranslationslang-jaJapanese translations

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@SwftAlpc@tiangolo@alejsdev@Attsun1031@tokusumi@delhi09@ryuckel

Comments


[8]ページ先頭

©2009-2026 Movatter.jp