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

✏️ Fix typos indocs/en/docs/how-to/separate-openapi-schemas.md anddocs/en/docs/tutorial/schema-extra-example.md#10189

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 intofastapi:masterfromxzmeng:fix-typos
Sep 2, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletiondocs/en/docs/how-to/separate-openapi-schemas.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -160,7 +160,7 @@ If you interact with the docs and check the response, even though the code didn'

This means that it will **always have a value**, it's just that sometimes the value could be `None` (or `null` in JSON).

That means that, clients using your API don't have to check if the value exists or not, they can **asume the field will always be there**, but just that in some cases it will have the default value of `None`.
That means that, clients using your API don't have to check if the value exists or not, they can **assume the field will always be there**, but just that in some cases it will have the default value of `None`.

The way to describe this in OpenAPI, is to mark that field as **required**, because it will always be there.

Expand Down
4 changes: 2 additions & 2 deletionsdocs/en/docs/tutorial/schema-extra-example.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,13 +38,13 @@ That extra info will be added as-is to the output **JSON Schema** for that model

In Pydantic version 2, you would use the attribute `model_config`, that takes a `dict` as described in <a href="https://docs.pydantic.dev/latest/usage/model_config/" class="external-link" target="_blank">Pydantic's docs: Model Config</a>.

You can set `"json_schema_extra"` with a `dict` containing anyadditonal data you would like to show up in the generated JSON Schema, including `examples`.
You can set `"json_schema_extra"` with a `dict` containing anyadditional data you would like to show up in the generated JSON Schema, including `examples`.

=== "Pydantic v1"

In Pydantic version 1, you would use an internal class `Config` and `schema_extra`, as described in <a href="https://docs.pydantic.dev/1.10/usage/schema/#schema-customization" class="external-link" target="_blank">Pydantic's docs: Schema customization</a>.

You can set `schema_extra` with a `dict` containing anyadditonal data you would like to show up in the generated JSON Schema, including `examples`.
You can set `schema_extra` with a `dict` containing anyadditional data you would like to show up in the generated JSON Schema, including `examples`.

!!! tip
You could use the same technique to extend the JSON Schema and add your own custom extra info.
Expand Down

[8]ページ先頭

©2009-2026 Movatter.jp