Browse Source

✏️ Fix typos in `docs/en/docs/how-to/separate-openapi-schemas.md` and `docs/en/docs/tutorial/schema-extra-example.md` (#10189)

pull/10204/head
xzmeng 2 years ago
committed by GitHub
parent
commit
d8f2f39f6d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/en/docs/how-to/separate-openapi-schemas.md
  2. 4
      docs/en/docs/tutorial/schema-extra-example.md

2
docs/en/docs/how-to/separate-openapi-schemas.md

@ -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). 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. The way to describe this in OpenAPI, is to mark that field as **required**, because it will always be there.

4
docs/en/docs/tutorial/schema-extra-example.md

@ -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>. 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 any additonal data you would like to show up in the generated JSON Schema, including `examples`. You can set `"json_schema_extra"` with a `dict` containing any additional data you would like to show up in the generated JSON Schema, including `examples`.
=== "Pydantic v1" === "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>. 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 any additonal data you would like to show up in the generated JSON Schema, including `examples`. You can set `schema_extra` with a `dict` containing any additional data you would like to show up in the generated JSON Schema, including `examples`.
!!! tip !!! tip
You could use the same technique to extend the JSON Schema and add your own custom extra info. You could use the same technique to extend the JSON Schema and add your own custom extra info.

Loading…
Cancel
Save