From: Yurii Motov Date: Fri, 10 Jul 2026 15:57:44 +0000 (+0200) Subject: Fix redirect docs.pydantic.dev X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e276b7fd37543b39ecbe959e1fe831dae6baeb28;p=thirdparty%2Ffastapi%2Ffastapi.git Fix redirect docs.pydantic.dev --- diff --git a/README.md b/README.md index 5367cd3a1a..61b7b96283 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ If you are building a CLI app to be FastAPI stands on the shoulders of giants: * [Starlette](https://starlette.dev/) for the web parts. -* [Pydantic](https://docs.pydantic.dev/) for the data parts. +* [Pydantic](https://pydantic.dev/docs/) for the data parts. ## Installation @@ -526,7 +526,7 @@ There are some additional dependencies you might want to install. Additional optional Pydantic dependencies: -* [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - for settings management. +* [`pydantic-settings`](https://pydantic.dev/docs/validation/latest/concepts/pydantic_settings/) - for settings management. * [`pydantic-extra-types`](https://github.com/pydantic/pydantic-extra-types) - for extra types to be used with Pydantic. Additional optional FastAPI dependencies: diff --git a/docs/en/docs/advanced/dataclasses.md b/docs/en/docs/advanced/dataclasses.md index 469eff65bf..1fee424540 100644 --- a/docs/en/docs/advanced/dataclasses.md +++ b/docs/en/docs/advanced/dataclasses.md @@ -88,7 +88,7 @@ Check the in-code annotation tips above to see more specific details. You can also combine `dataclasses` with other Pydantic models, inherit from them, include them in your own models, etc. -To learn more, check the [Pydantic docs about dataclasses](https://docs.pydantic.dev/latest/concepts/dataclasses/). +To learn more, check the [Pydantic docs about dataclasses](https://pydantic.dev/docs/validation/latest/concepts/dataclasses/). ## Version { #version } diff --git a/docs/en/docs/advanced/openapi-callbacks.md b/docs/en/docs/advanced/openapi-callbacks.md index 17910e1cfc..d8c384ad8d 100644 --- a/docs/en/docs/advanced/openapi-callbacks.md +++ b/docs/en/docs/advanced/openapi-callbacks.md @@ -35,7 +35,7 @@ This part is pretty normal, most of the code is probably already familiar to you /// tip -The `callback_url` query parameter uses a Pydantic [Url](https://docs.pydantic.dev/latest/api/networks/) type. +The `callback_url` query parameter uses a Pydantic [Url](https://pydantic.dev/docs/validation/latest/api/pydantic/networks/) type. /// diff --git a/docs/en/docs/advanced/settings.md b/docs/en/docs/advanced/settings.md index ff313f0881..b864f3d337 100644 --- a/docs/en/docs/advanced/settings.md +++ b/docs/en/docs/advanced/settings.md @@ -20,7 +20,7 @@ That means that any value read in Python from an environment variable will be a ## Pydantic `Settings` { #pydantic-settings } -Fortunately, Pydantic provides a great utility to handle these settings coming from environment variables with [Pydantic: Settings management](https://docs.pydantic.dev/latest/concepts/pydantic_settings/). +Fortunately, Pydantic provides a great utility to handle these settings coming from environment variables with [Pydantic: Settings management](https://pydantic.dev/docs/validation/latest/concepts/pydantic_settings/). ### Install `pydantic-settings` { #install-pydantic-settings } @@ -172,7 +172,7 @@ But a dotenv file doesn't really have to have that exact filename. /// -Pydantic has support for reading from these types of files using an external library. You can read more at [Pydantic Settings: Dotenv (.env) support](https://docs.pydantic.dev/latest/concepts/pydantic_settings/#dotenv-env-support). +Pydantic has support for reading from these types of files using an external library. You can read more at [Pydantic Settings: Dotenv (.env) support](https://pydantic.dev/docs/validation/latest/concepts/pydantic_settings/#dotenv-env-support). /// tip @@ -197,7 +197,7 @@ And then update your `config.py` with: /// tip -The `model_config` attribute is used just for Pydantic configuration. You can read more at [Pydantic: Concepts: Configuration](https://docs.pydantic.dev/latest/concepts/config/). +The `model_config` attribute is used just for Pydantic configuration. You can read more at [Pydantic: Concepts: Configuration](https://pydantic.dev/docs/validation/latest/concepts/config/). /// diff --git a/docs/en/docs/alternatives.md b/docs/en/docs/alternatives.md index adb2f67808..2aa4e48b92 100644 --- a/docs/en/docs/alternatives.md +++ b/docs/en/docs/alternatives.md @@ -401,7 +401,7 @@ I consider **FastAPI** a "spiritual successor" to APIStar, while improving and i ## Used by **FastAPI** { #used-by-fastapi } -### [Pydantic](https://docs.pydantic.dev/) { #pydantic } +### [Pydantic](https://pydantic.dev/docs/) { #pydantic } Pydantic is a library to define data validation, serialization and documentation (using JSON Schema) based on Python type hints. diff --git a/docs/en/docs/features.md b/docs/en/docs/features.md index 2be4eeee6f..42ddf60069 100644 --- a/docs/en/docs/features.md +++ b/docs/en/docs/features.md @@ -177,7 +177,7 @@ With **FastAPI** you get all of **Starlette**'s features (as FastAPI is just Sta ## Pydantic features { #pydantic-features } -**FastAPI** is fully compatible with (and based on) [**Pydantic**](https://docs.pydantic.dev/). So, any additional Pydantic code you have, will also work. +**FastAPI** is fully compatible with (and based on) [**Pydantic**](https://pydantic.dev/docs/). So, any additional Pydantic code you have, will also work. Including external libraries also based on Pydantic, such as ORMs and ODMs for databases. diff --git a/docs/en/docs/history-design-future.md b/docs/en/docs/history-design-future.md index d3dedee67c..6779548d4f 100644 --- a/docs/en/docs/history-design-future.md +++ b/docs/en/docs/history-design-future.md @@ -54,7 +54,7 @@ All in a way that provided the best development experience for all the developer ## Requirements { #requirements } -After testing several alternatives, I decided that I was going to use [**Pydantic**](https://docs.pydantic.dev/) for its advantages. +After testing several alternatives, I decided that I was going to use [**Pydantic**](https://pydantic.dev/docs/) for its advantages. Then I contributed to it, to make it fully compliant with JSON Schema, to support different ways to define constraint declarations, and to improve editor support (type checks, autocompletion) based on the tests in several editors. diff --git a/docs/en/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md b/docs/en/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md index 816cf54f54..7b19dddb23 100644 --- a/docs/en/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md +++ b/docs/en/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md @@ -24,7 +24,7 @@ If you have an old FastAPI app with Pydantic v1, here I'll show you how to migra ## Official Guide { #official-guide } -Pydantic has an official [Migration Guide](https://docs.pydantic.dev/latest/migration/) from v1 to v2. +Pydantic has an official [Migration Guide](https://pydantic.dev/docs/validation/latest/get-started/migration/) from v1 to v2. It also includes what has changed, how validations are now more correct and strict, possible caveats, etc. diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md index 9b008a5969..92bdfe319d 100644 --- a/docs/en/docs/index.md +++ b/docs/en/docs/index.md @@ -176,7 +176,7 @@ If you are building a CLI app to be FastAPI stands on the shoulders of giants: * [Starlette](https://starlette.dev/) for the web parts. -* [Pydantic](https://docs.pydantic.dev/) for the data parts. +* [Pydantic](https://pydantic.dev/docs/) for the data parts. ## Installation { #installation } @@ -572,7 +572,7 @@ There are some additional dependencies you might want to install. Additional optional Pydantic dependencies: -* [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - for settings management. +* [`pydantic-settings`](https://pydantic.dev/docs/validation/latest/concepts/pydantic_settings/) - for settings management. * [`pydantic-extra-types`](https://github.com/pydantic/pydantic-extra-types) - for extra types to be used with Pydantic. Additional optional FastAPI dependencies: diff --git a/docs/en/docs/project-generation.md b/docs/en/docs/project-generation.md index ab6e87527b..a0527bbb18 100644 --- a/docs/en/docs/project-generation.md +++ b/docs/en/docs/project-generation.md @@ -10,7 +10,7 @@ GitHub Repository: [Full Stack FastAPI Template](https://github.com/tiangolo/ful - ⚡ [**FastAPI**](https://fastapi.tiangolo.com) for the Python backend API. - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) for the Python SQL database interactions (ORM). - - 🔍 [Pydantic](https://docs.pydantic.dev), used by FastAPI, for the data validation and settings management. + - 🔍 [Pydantic](https://pydantic.dev/docs/), used by FastAPI, for the data validation and settings management. - 💾 [PostgreSQL](https://www.postgresql.org) as the SQL database. - 🚀 [React](https://react.dev) for the frontend. - 💃 Using TypeScript, hooks, Vite, and other parts of a modern frontend stack. diff --git a/docs/en/docs/python-types.md b/docs/en/docs/python-types.md index c8d9bf41c9..d54faac9b4 100644 --- a/docs/en/docs/python-types.md +++ b/docs/en/docs/python-types.md @@ -269,7 +269,7 @@ It doesn't mean "`one_person` is the **class** called `Person`". ## Pydantic models { #pydantic-models } -[Pydantic](https://docs.pydantic.dev/) is a Python library to perform data validation. +[Pydantic](https://pydantic.dev/docs/) is a Python library to perform data validation. You declare the "shape" of the data as classes with attributes. @@ -285,7 +285,7 @@ An example from the official Pydantic docs: /// note -To learn more about [Pydantic, check its docs](https://docs.pydantic.dev/). +To learn more about [Pydantic, check its docs](https://pydantic.dev/docs/). /// diff --git a/docs/en/docs/release-notes.md b/docs/en/docs/release-notes.md index ebd74f4874..8e35f163cb 100644 --- a/docs/en/docs/release-notes.md +++ b/docs/en/docs/release-notes.md @@ -4046,7 +4046,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a * The attribute `schema_extra` for the internal class `Config` has been replaced by the key `json_schema_extra` in the new `model_config` dict. * You can read more about it in the docs for [Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/). * When you install `"fastapi[all]"` it now also includes: - * [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - for settings management. + * [`pydantic-settings`](https://pydantic.dev/docs/validation/latest/concepts/pydantic_settings/) - for settings management. * [`pydantic-extra-types`](https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/) - for extra types to be used with Pydantic. * Now Pydantic Settings is an additional optional package (included in `"fastapi[all]"`). To use settings you should now import `from pydantic_settings import BaseSettings` instead of importing from `pydantic` directly. * You can read more about it in the docs for [Settings and Environment Variables](https://fastapi.tiangolo.com/advanced/settings/). diff --git a/docs/en/docs/tutorial/body-nested-models.md b/docs/en/docs/tutorial/body-nested-models.md index 61ed932022..b7c17c7cd9 100644 --- a/docs/en/docs/tutorial/body-nested-models.md +++ b/docs/en/docs/tutorial/body-nested-models.md @@ -96,7 +96,7 @@ Again, doing just that declaration, with **FastAPI** you get: Apart from normal singular types like `str`, `int`, `float`, etc. you can use more complex singular types that inherit from `str`. -To see all the options you have, check out [Pydantic's Type Overview](https://docs.pydantic.dev/latest/concepts/types/). You will see some examples in the next chapter. +To see all the options you have, check out [Pydantic's Type Overview](https://pydantic.dev/docs/validation/latest/concepts/types/). You will see some examples in the next chapter. For example, as in the `Image` model we have a `url` field, we can declare it to be an instance of Pydantic's `HttpUrl` instead of a `str`: diff --git a/docs/en/docs/tutorial/body.md b/docs/en/docs/tutorial/body.md index b074a751dd..0375f49a9d 100644 --- a/docs/en/docs/tutorial/body.md +++ b/docs/en/docs/tutorial/body.md @@ -6,7 +6,7 @@ A **request** body is data sent by the client to your API. A **response** body i Your API almost always has to send a **response** body. But clients don't necessarily need to send **request bodies** all the time, sometimes they only request a path, maybe with some query parameters, but don't send a body. -To declare a **request** body, you use [Pydantic](https://docs.pydantic.dev/) models with all their power and benefits. +To declare a **request** body, you use [Pydantic](https://pydantic.dev/docs/) models with all their power and benefits. /// note diff --git a/docs/en/docs/tutorial/extra-data-types.md b/docs/en/docs/tutorial/extra-data-types.md index 53dd46c914..e965f298e5 100644 --- a/docs/en/docs/tutorial/extra-data-types.md +++ b/docs/en/docs/tutorial/extra-data-types.md @@ -36,7 +36,7 @@ Here are some of the additional data types you can use: * `datetime.timedelta`: * A Python `datetime.timedelta`. * In requests and responses will be represented as a `float` of total seconds. - * Pydantic also allows representing it as an "ISO 8601 time diff encoding", [see the docs for more info](https://docs.pydantic.dev/latest/concepts/serialization/#custom-serializers). + * Pydantic also allows representing it as an "ISO 8601 time diff encoding", [see the docs for more info](https://pydantic.dev/docs/validation/latest/concepts/serialization/#custom-serializers). * `frozenset`: * In requests and responses, treated the same as a `set`: * In requests, a list will be read, eliminating duplicates and converting it to a `set`. diff --git a/docs/en/docs/tutorial/extra-models.md b/docs/en/docs/tutorial/extra-models.md index d2b53cb66f..565c74fec5 100644 --- a/docs/en/docs/tutorial/extra-models.md +++ b/docs/en/docs/tutorial/extra-models.md @@ -166,7 +166,7 @@ To do that, use the standard Python type hint [`typing.Union`](https://docs.pyth /// note -When defining a [`Union`](https://docs.pydantic.dev/latest/concepts/types/#unions), include the most specific type first, followed by the less specific type. In the example below, the more specific `PlaneItem` comes before `CarItem` in `Union[PlaneItem, CarItem]`. +When defining a [`Union`](https://pydantic.dev/docs/validation/latest/concepts/types/#unions), include the most specific type first, followed by the less specific type. In the example below, the more specific `PlaneItem` comes before `CarItem` in `Union[PlaneItem, CarItem]`. /// diff --git a/docs/en/docs/tutorial/path-params.md b/docs/en/docs/tutorial/path-params.md index c8fe68f5e4..3eb92bdc46 100644 --- a/docs/en/docs/tutorial/path-params.md +++ b/docs/en/docs/tutorial/path-params.md @@ -102,7 +102,7 @@ The same way, there are many compatible tools. Including code generation tools f ## Pydantic { #pydantic } -All the data validation is performed under the hood by [Pydantic](https://docs.pydantic.dev/), so you get all the benefits from it. And you know you are in good hands. +All the data validation is performed under the hood by [Pydantic](https://pydantic.dev/docs/), so you get all the benefits from it. And you know you are in good hands. You can use the same type declarations with `str`, `float`, `bool` and many other complex data types. diff --git a/docs/en/docs/tutorial/query-params-str-validations.md b/docs/en/docs/tutorial/query-params-str-validations.md index eb9fa2607b..c4dd508571 100644 --- a/docs/en/docs/tutorial/query-params-str-validations.md +++ b/docs/en/docs/tutorial/query-params-str-validations.md @@ -370,11 +370,11 @@ There could be cases where you need to do some **custom validation** that can't In those cases, you can use a **custom validator function** that is applied after the normal validation (e.g. after validating that the value is a `str`). -You can achieve that using [Pydantic's `AfterValidator`](https://docs.pydantic.dev/latest/concepts/validators/#field-after-validator) inside of `Annotated`. +You can achieve that using [Pydantic's `AfterValidator`](https://pydantic.dev/docs/validation/latest/concepts/validators/#field-after-validator) inside of `Annotated`. /// tip -Pydantic also has [`BeforeValidator`](https://docs.pydantic.dev/latest/concepts/validators/#field-before-validator) and others. 🤓 +Pydantic also has [`BeforeValidator`](https://pydantic.dev/docs/validation/latest/concepts/validators/#field-before-validator) and others. 🤓 /// diff --git a/docs/en/docs/tutorial/schema-extra-example.md b/docs/en/docs/tutorial/schema-extra-example.md index 280162531d..792be68fc0 100644 --- a/docs/en/docs/tutorial/schema-extra-example.md +++ b/docs/en/docs/tutorial/schema-extra-example.md @@ -12,7 +12,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera 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. -You can use the attribute `model_config` that takes a `dict` as described in [Pydantic's docs: Configuration](https://docs.pydantic.dev/latest/api/config/). +You can use the attribute `model_config` that takes a `dict` as described in [Pydantic's docs: Configuration](https://pydantic.dev/docs/validation/latest/api/pydantic/config/). 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`.