Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

SwftAlpc
Copy link
Contributor

@SwftAlpc SwftAlpc commented Aug 20, 2020

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.

@SwftAlpc SwftAlpc mentioned this pull request Aug 20, 2020
@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #1938 into master will not change coverage.
The diff coverage is n/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 by Codecov. Last update f495d98...f82f73d. Read the comment docs.

@github-actions
Copy link
Contributor

📝 Docs preview for commit 8182bcd 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
Contributor Author

@tokusumi
Thanks for your review!
I fixed it.

@github-actions
Copy link
Contributor

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

@tiangolo tiangolo added awaiting-review lang-all Translations lang-ja Japanese translations labels Aug 29, 2020
@github-actions
Copy link
Contributor

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

Copy link
Contributor

@Attsun1031 Attsun1031 left a comment

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.

docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Show resolved Hide resolved
docs/ja/docs/tutorial/response-model.md Outdated Show resolved Hide resolved
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
SwftAlpc and others added 10 commits October 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 commit f82f73d at: https://5f9aa66b8b8d8319b2fce839--fastapi.netlify.app

Copy link

@delhi09 delhi09 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`を使用してフィールドの制限やシリアライズを行うからです。
Copy link

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`はデフォルト値と同じ値を持っているにもかかわらず、明示的に設定されていることを理解しています。(デフォルトから取得するのではなく)
Copy link

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`も使用することができます。
Copy link

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`を受け取り、含める(残りを省略する)か、除外(残りを含む)します。
Copy link

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"の目的語です。)

@tiangolo tiangolo changed the title Add tutorial/response-model.md. Japanese ver. 🌐 Add Japanese translation for docs/ja/docs/tutorial/response-model.md Jun 26, 2023
@tiangolo
Copy link
Owner

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

@alejsdev
Copy link
Collaborator

Thanks @SwftAlpc 🤓

Thanks for the reviews @tokusumi @Attsun1031 ✌️

@alejsdev alejsdev merged commit 5c71522 into tiangolo:master Jan 15, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review lang-all Translations lang-ja Japanese translations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants