Browse Source

📝 Remove more docs mentions to Pydantic v1

pull/14575/head
Sebastián Ramírez 7 months ago
parent
commit
d94344c7cd
  1. 1
      docs/en/docs/how-to/separate-openapi-schemas.md
  2. 24
      docs/en/docs/tutorial/schema-extra-example.md

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

@ -101,4 +101,3 @@ And now there will be one single schema for input and output for the model, only
<img src="/img/tutorial/separate-openapi-schemas/image05.png"> <img src="/img/tutorial/separate-openapi-schemas/image05.png">
</div> </div>
This is the same behavior as in Pydantic v1. 🤓

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

@ -8,36 +8,14 @@ Here are several ways to do it.
You can declare `examples` for a Pydantic model that will be added to the generated JSON Schema. You can declare `examples` for a Pydantic model that will be added to the generated JSON Schema.
//// tab | Pydantic v2
{* ../../docs_src/schema_extra_example/tutorial001_py310.py hl[13:24] *} {* ../../docs_src/schema_extra_example/tutorial001_py310.py hl[13:24] *}
////
//// tab | Pydantic v1
{* ../../docs_src/schema_extra_example/tutorial001_pv1_py310.py hl[13:23] *}
////
That extra info will be added as-is to the output **JSON Schema** for that model, and it will be used in the API docs. That extra info will be added as-is to the output **JSON Schema** for that model, and it will be used in the API docs.
//// tab | Pydantic v2 You can use the attribute `model_config` that takes a `dict` as described in <a href="https://docs.pydantic.dev/latest/api/config/" class="external-link" target="_blank">Pydantic's docs: Configuration</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/api/config/" class="external-link" target="_blank">Pydantic's docs: Configuration</a>.
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`. 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`.
////
//// tab | 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 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