Browse Source

🔄 Merge branch 'master' into drop-pv1

pull/14609/head
Sebastián Ramírez 7 months ago
parent
commit
5eacf7ee4c
  1. 23
      .github/workflows/test.yml
  2. 25
      .pre-commit-config.yaml
  3. 6
      README.md
  4. 6
      docs/de/docs/advanced/dataclasses.md
  5. 2
      docs/de/docs/how-to/graphql.md
  6. 18
      docs/de/docs/index.md
  7. 1
      docs/de/llm-prompt.md
  8. 6
      docs/en/docs/advanced/dataclasses.md
  9. 2
      docs/en/docs/how-to/graphql.md
  10. BIN
      docs/en/docs/img/fastapi-documentary.jpg
  11. 6
      docs/en/docs/index.md
  12. 14
      docs/en/docs/release-notes.md
  13. 6
      docs/es/docs/advanced/dataclasses.md
  14. 2
      docs/es/docs/how-to/graphql.md
  15. 6
      docs/pt/docs/advanced/dataclasses.md
  16. 2
      docs/pt/docs/how-to/graphql.md
  17. 6
      docs/ru/docs/advanced/dataclasses.md
  18. 2
      docs/ru/docs/how-to/graphql.md
  19. 6
      docs/zh/docs/advanced/dataclasses.md
  20. 0
      docs_src/additional_responses/__init__.py
  21. 0
      docs_src/additional_status_codes/__init__.py
  22. 0
      docs_src/advanced_middleware/__init__.py
  23. 0
      docs_src/authentication_error_status_code/__init__.py
  24. 0
      docs_src/background_tasks/__init__.py
  25. 0
      docs_src/behind_a_proxy/__init__.py
  26. 0
      docs_src/body/__init__.py
  27. 0
      docs_src/body_fields/__init__.py
  28. 0
      docs_src/body_multiple_params/__init__.py
  29. 0
      docs_src/body_nested_models/__init__.py
  30. 0
      docs_src/body_updates/__init__.py
  31. 0
      docs_src/conditional_openapi/__init__.py
  32. 0
      docs_src/configure_swagger_ui/__init__.py
  33. 0
      docs_src/cookie_param_models/__init__.py
  34. 0
      docs_src/cookie_params/__init__.py
  35. 0
      docs_src/cors/__init__.py
  36. 0
      docs_src/custom_docs_ui/__init__.py
  37. 0
      docs_src/custom_request_and_route/__init__.py
  38. 0
      docs_src/custom_response/__init__.py
  39. 0
      docs_src/dataclasses_/__init__.py
  40. 0
      docs_src/dataclasses_/tutorial001_py310.py
  41. 0
      docs_src/dataclasses_/tutorial001_py39.py
  42. 0
      docs_src/dataclasses_/tutorial002_py310.py
  43. 0
      docs_src/dataclasses_/tutorial002_py39.py
  44. 0
      docs_src/dataclasses_/tutorial003_py310.py
  45. 0
      docs_src/dataclasses_/tutorial003_py39.py
  46. 0
      docs_src/debugging/__init__.py
  47. 0
      docs_src/dependencies/__init__.py
  48. 0
      docs_src/dependency_testing/__init__.py
  49. 0
      docs_src/encoder/__init__.py
  50. 0
      docs_src/events/__init__.py
  51. 0
      docs_src/extending_openapi/__init__.py
  52. 0
      docs_src/extra_data_types/__init__.py
  53. 0
      docs_src/extra_models/__init__.py
  54. 0
      docs_src/first_steps/__init__.py
  55. 0
      docs_src/generate_clients/__init__.py
  56. 0
      docs_src/graphql_/__init__.py
  57. 0
      docs_src/graphql_/tutorial001_py39.py
  58. 0
      docs_src/handling_errors/__init__.py
  59. 0
      docs_src/header_param_models/__init__.py
  60. 0
      docs_src/header_params/__init__.py
  61. 0
      docs_src/metadata/__init__.py
  62. 0
      docs_src/middleware/__init__.py
  63. 0
      docs_src/openapi_callbacks/__init__.py
  64. 0
      docs_src/openapi_webhooks/__init__.py
  65. 0
      docs_src/path_operation_advanced_configuration/__init__.py
  66. 0
      docs_src/path_operation_configuration/__init__.py
  67. 0
      docs_src/path_params/__init__.py
  68. 0
      docs_src/path_params_numeric_validations/__init__.py
  69. 0
      docs_src/pydantic_v1_in_v2/__init__.py
  70. 0
      docs_src/python_types/__init__.py
  71. 0
      docs_src/query_param_models/__init__.py
  72. 0
      docs_src/query_params/__init__.py
  73. 0
      docs_src/query_params_str_validations/__init__.py
  74. 0
      docs_src/request_files/__init__.py
  75. 0
      docs_src/request_form_models/__init__.py
  76. 0
      docs_src/request_forms/__init__.py
  77. 0
      docs_src/request_forms_and_files/__init__.py
  78. 0
      docs_src/response_change_status_code/__init__.py
  79. 0
      docs_src/response_cookies/__init__.py
  80. 0
      docs_src/response_directly/__init__.py
  81. 0
      docs_src/response_headers/__init__.py
  82. 0
      docs_src/response_model/__init__.py
  83. 0
      docs_src/response_status_code/__init__.py
  84. 0
      docs_src/schema_extra_example/__init__.py
  85. 0
      docs_src/security/__init__.py
  86. 0
      docs_src/separate_openapi_schemas/__init__.py
  87. 0
      docs_src/settings/__init__.py
  88. 0
      docs_src/static_files/__init__.py
  89. 0
      docs_src/sub_applications/__init__.py
  90. 0
      docs_src/templates/__init__.py
  91. 0
      docs_src/templates/static/__init__.py
  92. 0
      docs_src/templates/templates/__init__.py
  93. 0
      docs_src/using_request_directly/__init__.py
  94. 0
      docs_src/wsgi/__init__.py
  95. 2
      fastapi/__init__.py
  96. 7
      fastapi/exceptions.py
  97. 5
      fastapi/openapi/utils.py
  98. 9
      fastapi/params.py
  99. 9
      fastapi/temp_pydantic_v1_params.py
  100. 5
      fastapi/utils.py

23
.github/workflows/test.yml

@ -16,29 +16,6 @@ env:
UV_SYSTEM_PYTHON: 1 UV_SYSTEM_PYTHON: 1
jobs: jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: |
requirements**.txt
pyproject.toml
- name: Install Dependencies
run: uv pip install -r requirements-tests.txt
- name: Lint
run: bash scripts/lint.sh
test: test:
strategy: strategy:
matrix: matrix:

25
.pre-commit-config.yaml

@ -12,15 +12,23 @@ repos:
- --unsafe - --unsafe
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.3
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
- repo: local - repo: local
hooks: hooks:
- id: local-ruff-check
name: ruff check
entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
require_serial: true
language: unsupported
types: [python]
- id: local-ruff-format
name: ruff format
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
require_serial: true
language: unsupported
types: [python]
- id: add-permalinks-pages - id: add-permalinks-pages
language: unsupported language: unsupported
name: add-permalinks-pages name: add-permalinks-pages
@ -28,18 +36,21 @@ repos:
args: args:
- --update-existing - --update-existing
files: ^docs/en/docs/.*\.md$ files: ^docs/en/docs/.*\.md$
- id: generate-readme - id: generate-readme
language: unsupported language: unsupported
name: generate README.md from index.md name: generate README.md from index.md
entry: uv run ./scripts/docs.py generate-readme entry: uv run ./scripts/docs.py generate-readme
files: ^docs/en/docs/index\.md|docs/en/data/sponsors\.yml|scripts/docs\.py$ files: ^docs/en/docs/index\.md|docs/en/data/sponsors\.yml|scripts/docs\.py$
pass_filenames: false pass_filenames: false
- id: update-languages - id: update-languages
language: unsupported language: unsupported
name: update languages name: update languages
entry: uv run ./scripts/docs.py update-languages entry: uv run ./scripts/docs.py update-languages
files: ^docs/.*|scripts/docs\.py$ files: ^docs/.*|scripts/docs\.py$
pass_filenames: false pass_filenames: false
- id: ensure-non-translated - id: ensure-non-translated
language: unsupported language: unsupported
name: ensure non-translated files are not modified name: ensure non-translated files are not modified

6
README.md

@ -120,6 +120,12 @@ The key features are:
--- ---
## FastAPI mini documentary
There's a <a href="https://www.youtube.com/watch?v=mpR8ngthqiE" class="external-link" target="_blank">FastAPI mini documentary</a> released at the end of 2025, you can watch it online:
<a href="https://www.youtube.com/watch?v=mpR8ngthqiE" target="_blank"><img src="https://fastapi.tiangolo.com/img/fastapi-documentary.jpg" alt="FastAPI Mini Documentary"></a>
## **Typer**, the FastAPI of CLIs ## **Typer**, the FastAPI of CLIs
<a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a> <a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a>

6
docs/de/docs/advanced/dataclasses.md

@ -4,7 +4,7 @@ FastAPI basiert auf **Pydantic**, und ich habe Ihnen gezeigt, wie Sie Pydantic-M
Aber FastAPI unterstützt auf die gleiche Weise auch die Verwendung von <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a>: Aber FastAPI unterstützt auf die gleiche Weise auch die Verwendung von <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a>:
{* ../../docs_src/dataclasses/tutorial001_py310.py hl[1,6:11,18:19] *} {* ../../docs_src/dataclasses_/tutorial001_py310.py hl[1,6:11,18:19] *}
Das ist dank **Pydantic** ebenfalls möglich, da es <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">`dataclasses` intern unterstützt</a>. Das ist dank **Pydantic** ebenfalls möglich, da es <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">`dataclasses` intern unterstützt</a>.
@ -32,7 +32,7 @@ Wenn Sie jedoch eine Menge Datenklassen herumliegen haben, ist dies ein guter Tr
Sie können `dataclasses` auch im Parameter `response_model` verwenden: Sie können `dataclasses` auch im Parameter `response_model` verwenden:
{* ../../docs_src/dataclasses/tutorial002_py310.py hl[1,6:12,18] *} {* ../../docs_src/dataclasses_/tutorial002_py310.py hl[1,6:12,18] *}
Die Datenklasse wird automatisch in eine Pydantic-Datenklasse konvertiert. Die Datenklasse wird automatisch in eine Pydantic-Datenklasse konvertiert.
@ -48,7 +48,7 @@ In einigen Fällen müssen Sie möglicherweise immer noch Pydantics Version von
In diesem Fall können Sie einfach die Standard-`dataclasses` durch `pydantic.dataclasses` ersetzen, was einen direkten Ersatz darstellt: In diesem Fall können Sie einfach die Standard-`dataclasses` durch `pydantic.dataclasses` ersetzen, was einen direkten Ersatz darstellt:
{* ../../docs_src/dataclasses/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *} {* ../../docs_src/dataclasses_/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *}
1. Wir importieren `field` weiterhin von Standard-`dataclasses`. 1. Wir importieren `field` weiterhin von Standard-`dataclasses`.

2
docs/de/docs/how-to/graphql.md

@ -35,7 +35,7 @@ Abhängig von Ihrem Anwendungsfall könnten Sie eine andere Bibliothek vorziehen
Hier ist eine kleine Vorschau, wie Sie Strawberry mit FastAPI integrieren können: Hier ist eine kleine Vorschau, wie Sie Strawberry mit FastAPI integrieren können:
{* ../../docs_src/graphql/tutorial001_py39.py hl[3,22,25] *} {* ../../docs_src/graphql_/tutorial001_py39.py hl[3,22,25] *}
Weitere Informationen zu Strawberry finden Sie in der <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry-Dokumentation</a>. Weitere Informationen zu Strawberry finden Sie in der <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry-Dokumentation</a>.

18
docs/de/docs/index.md

@ -117,6 +117,12 @@ Seine Schlüssel-Merkmale sind:
--- ---
## FastAPI Mini-Dokumentarfilm { #fastapi-mini-documentary }
Es gibt einen <a href="https://www.youtube.com/watch?v=mpR8ngthqiE" class="external-link" target="_blank">FastAPI-Mini-Dokumentarfilm</a>, veröffentlicht Ende 2025, Sie können ihn online ansehen:
<a href="https://www.youtube.com/watch?v=mpR8ngthqiE" target="_blank"><img src="https://fastapi.tiangolo.com/img/fastapi-documentary.jpg" alt="FastAPI Mini-Dokumentarfilm"></a>
## **Typer**, das FastAPI der CLIs { #typer-the-fastapi-of-clis } ## **Typer**, das FastAPI der CLIs { #typer-the-fastapi-of-clis }
<a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a> <a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a>
@ -233,7 +239,7 @@ INFO: Application startup complete.
</div> </div>
<details markdown="1"> <details markdown="1">
<summary>Was der Befehl <code>fastapi dev main.py</code> macht ...</summary> <summary>Über den Befehl <code>fastapi dev main.py</code> ...</summary>
Der Befehl `fastapi dev` liest Ihre `main.py`-Datei, erkennt die **FastAPI**-App darin und startet einen Server mit <a href="https://www.uvicorn.dev" class="external-link" target="_blank">Uvicorn</a>. Der Befehl `fastapi dev` liest Ihre `main.py`-Datei, erkennt die **FastAPI**-App darin und startet einen Server mit <a href="https://www.uvicorn.dev" class="external-link" target="_blank">Uvicorn</a>.
@ -276,7 +282,7 @@ Sie sehen die alternative automatische Dokumentation (bereitgestellt von <a href
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png) ![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Beispiel Aktualisierung { #example-upgrade } ## Beispielaktualisierung { #example-upgrade }
Ändern Sie jetzt die Datei `main.py`, um den <abbr title="Body – Körper, Inhalt: Der eigentliche Inhalt einer Nachricht, nicht die Metadaten">Body</abbr> eines `PUT`-Requests zu empfangen. Ändern Sie jetzt die Datei `main.py`, um den <abbr title="Body – Körper, Inhalt: Der eigentliche Inhalt einer Nachricht, nicht die Metadaten">Body</abbr> eines `PUT`-Requests zu empfangen.
@ -326,7 +332,7 @@ Gehen Sie jetzt auf <a href="http://127.0.0.1:8000/docs" class="external-link" t
![Swagger UI Interaktion](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png) ![Swagger UI Interaktion](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)
* Klicken Sie dann auf den Button „Execute“, die Benutzeroberfläche wird mit Ihrer API kommunizieren, sendet die Parameter, holt die Ergebnisse und zeigt sie auf dem Bildschirm an: * Klicken Sie dann auf den Button „Execute“, die Benutzeroberfläche wird mit Ihrer API kommunizieren, die Parameter senden, die Ergebnisse erhalten und sie auf dem Bildschirm anzeigen:
![Swagger UI Interaktion](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png) ![Swagger UI Interaktion](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
@ -439,7 +445,7 @@ Für ein vollständigeres Beispiel, mit weiteren Funktionen, siehe das <a href="
* Deklaration von **Parametern** von anderen verschiedenen Stellen wie: **Header**, **Cookies**, **Formularfelder** und **Dateien**. * Deklaration von **Parametern** von anderen verschiedenen Stellen wie: **Header**, **Cookies**, **Formularfelder** und **Dateien**.
* Wie man **Validierungs-Constraints** wie `maximum_length` oder `regex` setzt. * Wie man **Validierungs-Constraints** wie `maximum_length` oder `regex` setzt.
* Ein sehr leistungsfähiges und einfach zu bedienendes System für **<abbr title="Dependency Injection – Einbringen von Abhängigkeiten: Auch bekannt als Komponenten, Ressourcen, Provider, Services, Injectables">Dependency Injection</abbr>**. * Ein sehr leistungsfähiges und einfach zu bedienendes System für **<abbr title="auch bekannt als Komponenten, Ressourcen, Provider, Services, Injectables">Dependency Injection</abbr>**.
* Sicherheit und Authentifizierung, einschließlich Unterstützung für **OAuth2** mit **JWT-Tokens** und **HTTP Basic** Authentifizierung. * Sicherheit und Authentifizierung, einschließlich Unterstützung für **OAuth2** mit **JWT-Tokens** und **HTTP Basic** Authentifizierung.
* Fortgeschrittenere (aber ebenso einfache) Techniken zur Deklaration **tief verschachtelter JSON-Modelle** (dank Pydantic). * Fortgeschrittenere (aber ebenso einfache) Techniken zur Deklaration **tief verschachtelter JSON-Modelle** (dank Pydantic).
* **GraphQL**-Integration mit <a href="https://strawberry.rocks" class="external-link" target="_blank">Strawberry</a> und anderen Bibliotheken. * **GraphQL**-Integration mit <a href="https://strawberry.rocks" class="external-link" target="_blank">Strawberry</a> und anderen Bibliotheken.
@ -452,7 +458,7 @@ Für ein vollständigeres Beispiel, mit weiteren Funktionen, siehe das <a href="
### Ihre App deployen (optional) { #deploy-your-app-optional } ### Ihre App deployen (optional) { #deploy-your-app-optional }
Optional können Sie Ihre FastAPI-App in die <a href="https://fastapicloud.com" class="external-link" target="_blank">FastAPI Cloud</a> deployen, treten Sie der Warteliste bei, falls noch nicht geschehen. 🚀 Optional können Sie Ihre FastAPI-App in die <a href="https://fastapicloud.com" class="external-link" target="_blank">FastAPI Cloud</a> deployen, gehen Sie und treten Sie der Warteliste bei, falls noch nicht geschehen. 🚀
Wenn Sie bereits ein **FastAPI Cloud**-Konto haben (wir haben Sie von der Warteliste eingeladen 😉), können Sie Ihre Anwendung mit einem einzigen Befehl deployen. Wenn Sie bereits ein **FastAPI Cloud**-Konto haben (wir haben Sie von der Warteliste eingeladen 😉), können Sie Ihre Anwendung mit einem einzigen Befehl deployen.
@ -494,7 +500,7 @@ Es vereinfacht den Prozess des **Erstellens**, **Deployens** und **Zugreifens**
Es bringt die gleiche **Developer-Experience** beim Erstellen von Apps mit FastAPI auch zum **Deployment** in der Cloud. 🎉 Es bringt die gleiche **Developer-Experience** beim Erstellen von Apps mit FastAPI auch zum **Deployment** in der Cloud. 🎉
FastAPI Cloud ist der Hauptsponsor und Finanzierer der „FastAPI and friends“ Open-Source-Projekte. ✨ FastAPI Cloud ist der Hauptsponsor und Finanzierer der *FastAPI and friends* Open-Source-Projekte. ✨
#### Bei anderen Cloudanbietern deployen { #deploy-to-other-cloud-providers } #### Bei anderen Cloudanbietern deployen { #deploy-to-other-cloud-providers }

1
docs/de/llm-prompt.md

@ -251,6 +251,7 @@ Below is a list of English terms and their preferred German translations, separa
* «the button»: «der Button» * «the button»: «der Button»
* «the cloud provider»: «der Cloudanbieter» * «the cloud provider»: «der Cloudanbieter»
* «the CLI»: «Das CLI» * «the CLI»: «Das CLI»
* «the coverage»: «Die Testabdeckung»
* «the command line interface»: «Das Kommandozeileninterface» * «the command line interface»: «Das Kommandozeileninterface»
* «the default value»: «der Defaultwert» * «the default value»: «der Defaultwert»
* «the default value»: NOT «der Standardwert» * «the default value»: NOT «der Standardwert»

6
docs/en/docs/advanced/dataclasses.md

@ -4,7 +4,7 @@ FastAPI is built on top of **Pydantic**, and I have been showing you how to use
But FastAPI also supports using <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> the same way: But FastAPI also supports using <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> the same way:
{* ../../docs_src/dataclasses/tutorial001_py310.py hl[1,6:11,18:19] *} {* ../../docs_src/dataclasses_/tutorial001_py310.py hl[1,6:11,18:19] *}
This is still supported thanks to **Pydantic**, as it has <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">internal support for `dataclasses`</a>. This is still supported thanks to **Pydantic**, as it has <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">internal support for `dataclasses`</a>.
@ -32,7 +32,7 @@ But if you have a bunch of dataclasses laying around, this is a nice trick to us
You can also use `dataclasses` in the `response_model` parameter: You can also use `dataclasses` in the `response_model` parameter:
{* ../../docs_src/dataclasses/tutorial002_py310.py hl[1,6:12,18] *} {* ../../docs_src/dataclasses_/tutorial002_py310.py hl[1,6:12,18] *}
The dataclass will be automatically converted to a Pydantic dataclass. The dataclass will be automatically converted to a Pydantic dataclass.
@ -48,7 +48,7 @@ In some cases, you might still have to use Pydantic's version of `dataclasses`.
In that case, you can simply swap the standard `dataclasses` with `pydantic.dataclasses`, which is a drop-in replacement: In that case, you can simply swap the standard `dataclasses` with `pydantic.dataclasses`, which is a drop-in replacement:
{* ../../docs_src/dataclasses/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *} {* ../../docs_src/dataclasses_/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *}
1. We still import `field` from standard `dataclasses`. 1. We still import `field` from standard `dataclasses`.

2
docs/en/docs/how-to/graphql.md

@ -35,7 +35,7 @@ Depending on your use case, you might prefer to use a different library, but if
Here's a small preview of how you could integrate Strawberry with FastAPI: Here's a small preview of how you could integrate Strawberry with FastAPI:
{* ../../docs_src/graphql/tutorial001_py39.py hl[3,22,25] *} {* ../../docs_src/graphql_/tutorial001_py39.py hl[3,22,25] *}
You can learn more about Strawberry in the <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry documentation</a>. You can learn more about Strawberry in the <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry documentation</a>.

BIN
docs/en/docs/img/fastapi-documentary.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

6
docs/en/docs/index.md

@ -117,6 +117,12 @@ The key features are:
--- ---
## FastAPI mini documentary { #fastapi-mini-documentary }
There's a <a href="https://www.youtube.com/watch?v=mpR8ngthqiE" class="external-link" target="_blank">FastAPI mini documentary</a> released at the end of 2025, you can watch it online:
<a href="https://www.youtube.com/watch?v=mpR8ngthqiE" target="_blank"><img src="https://fastapi.tiangolo.com/img/fastapi-documentary.jpg" alt="FastAPI Mini Documentary"></a>
## **Typer**, the FastAPI of CLIs { #typer-the-fastapi-of-clis } ## **Typer**, the FastAPI of CLIs { #typer-the-fastapi-of-clis }
<a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a> <a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a>

14
docs/en/docs/release-notes.md

@ -7,12 +7,26 @@ hide:
## Latest Changes ## Latest Changes
## 0.127.1
### Refactors
* 🔊 Add a custom `FastAPIDeprecationWarning`. PR [#14605](https://github.com/fastapi/fastapi/pull/14605) by [@tiangolo](https://github.com/tiangolo).
### Docs
* 📝 Add documentary to website. PR [#14600](https://github.com/fastapi/fastapi/pull/14600) by [@tiangolo](https://github.com/tiangolo).
### Translations ### Translations
* 🌐 Update translations for de (update-outdated). PR [#14602](https://github.com/fastapi/fastapi/pull/14602) by [@nilslindemann](https://github.com/nilslindemann).
* 🌐 Update translations for de (update-outdated). PR [#14581](https://github.com/fastapi/fastapi/pull/14581) by [@nilslindemann](https://github.com/nilslindemann). * 🌐 Update translations for de (update-outdated). PR [#14581](https://github.com/fastapi/fastapi/pull/14581) by [@nilslindemann](https://github.com/nilslindemann).
### Internal ### Internal
* 🔧 Update pre-commit to use local Ruff instead of hook. PR [#14604](https://github.com/fastapi/fastapi/pull/14604) by [@tiangolo](https://github.com/tiangolo).
* ✅ Add missing tests for code examples. PR [#14569](https://github.com/fastapi/fastapi/pull/14569) by [@YuriiMotov](https://github.com/YuriiMotov).
* 👷 Remove `lint` job from `test` CI workflow. PR [#14593](https://github.com/fastapi/fastapi/pull/14593) by [@YuriiMotov](https://github.com/YuriiMotov).
* 👷 Update secrets check. PR [#14592](https://github.com/fastapi/fastapi/pull/14592) by [@tiangolo](https://github.com/tiangolo). * 👷 Update secrets check. PR [#14592](https://github.com/fastapi/fastapi/pull/14592) by [@tiangolo](https://github.com/tiangolo).
* 👷 Run CodSpeed tests in parallel to other tests to speed up CI. PR [#14586](https://github.com/fastapi/fastapi/pull/14586) by [@tiangolo](https://github.com/tiangolo). * 👷 Run CodSpeed tests in parallel to other tests to speed up CI. PR [#14586](https://github.com/fastapi/fastapi/pull/14586) by [@tiangolo](https://github.com/tiangolo).
* 🔨 Update scripts and pre-commit to autofix files. PR [#14585](https://github.com/fastapi/fastapi/pull/14585) by [@tiangolo](https://github.com/tiangolo). * 🔨 Update scripts and pre-commit to autofix files. PR [#14585](https://github.com/fastapi/fastapi/pull/14585) by [@tiangolo](https://github.com/tiangolo).

6
docs/es/docs/advanced/dataclasses.md

@ -4,7 +4,7 @@ FastAPI está construido sobre **Pydantic**, y te he estado mostrando cómo usar
Pero FastAPI también soporta el uso de <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> de la misma manera: Pero FastAPI también soporta el uso de <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> de la misma manera:
{* ../../docs_src/dataclasses/tutorial001_py310.py hl[1,6:11,18:19] *} {* ../../docs_src/dataclasses_/tutorial001_py310.py hl[1,6:11,18:19] *}
Esto sigue siendo soportado gracias a **Pydantic**, ya que tiene <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">soporte interno para `dataclasses`</a>. Esto sigue siendo soportado gracias a **Pydantic**, ya que tiene <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">soporte interno para `dataclasses`</a>.
@ -32,7 +32,7 @@ Pero si tienes un montón de dataclasses por ahí, este es un buen truco para us
También puedes usar `dataclasses` en el parámetro `response_model`: También puedes usar `dataclasses` en el parámetro `response_model`:
{* ../../docs_src/dataclasses/tutorial002_py310.py hl[1,6:12,18] *} {* ../../docs_src/dataclasses_/tutorial002_py310.py hl[1,6:12,18] *}
El dataclass será automáticamente convertido a un dataclass de Pydantic. El dataclass será automáticamente convertido a un dataclass de Pydantic.
@ -48,7 +48,7 @@ En algunos casos, todavía podrías tener que usar la versión de `dataclasses`
En ese caso, simplemente puedes intercambiar los `dataclasses` estándar con `pydantic.dataclasses`, que es un reemplazo directo: En ese caso, simplemente puedes intercambiar los `dataclasses` estándar con `pydantic.dataclasses`, que es un reemplazo directo:
{* ../../docs_src/dataclasses/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *} {* ../../docs_src/dataclasses_/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *}
1. Todavía importamos `field` de los `dataclasses` estándar. 1. Todavía importamos `field` de los `dataclasses` estándar.

2
docs/es/docs/how-to/graphql.md

@ -35,7 +35,7 @@ Dependiendo de tu caso de uso, podrías preferir usar un paquete diferente, pero
Aquí tienes una pequeña vista previa de cómo podrías integrar Strawberry con FastAPI: Aquí tienes una pequeña vista previa de cómo podrías integrar Strawberry con FastAPI:
{* ../../docs_src/graphql/tutorial001_py39.py hl[3,22,25] *} {* ../../docs_src/graphql_/tutorial001_py39.py hl[3,22,25] *}
Puedes aprender más sobre Strawberry en la <a href="https://strawberry.rocks/" class="external-link" target="_blank">documentación de Strawberry</a>. Puedes aprender más sobre Strawberry en la <a href="https://strawberry.rocks/" class="external-link" target="_blank">documentación de Strawberry</a>.

6
docs/pt/docs/advanced/dataclasses.md

@ -4,7 +4,7 @@ FastAPI é construído em cima do **Pydantic**, e eu tenho mostrado como usar mo
Mas o FastAPI também suporta o uso de <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> da mesma forma: Mas o FastAPI também suporta o uso de <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> da mesma forma:
{* ../../docs_src/dataclasses/tutorial001_py310.py hl[1,6:11,18:19] *} {* ../../docs_src/dataclasses_/tutorial001_py310.py hl[1,6:11,18:19] *}
Isso ainda é suportado graças ao **Pydantic**, pois ele tem <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">suporte interno para `dataclasses`</a>. Isso ainda é suportado graças ao **Pydantic**, pois ele tem <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">suporte interno para `dataclasses`</a>.
@ -32,7 +32,7 @@ Mas se você tem um monte de dataclasses por aí, este é um truque legal para u
Você também pode usar `dataclasses` no parâmetro `response_model`: Você também pode usar `dataclasses` no parâmetro `response_model`:
{* ../../docs_src/dataclasses/tutorial002_py310.py hl[1,6:12,18] *} {* ../../docs_src/dataclasses_/tutorial002_py310.py hl[1,6:12,18] *}
A dataclass será automaticamente convertida para uma dataclass Pydantic. A dataclass será automaticamente convertida para uma dataclass Pydantic.
@ -48,7 +48,7 @@ Em alguns casos, você ainda pode ter que usar a versão do Pydantic das `datacl
Nesse caso, você pode simplesmente trocar as `dataclasses` padrão por `pydantic.dataclasses`, que é um substituto direto: Nesse caso, você pode simplesmente trocar as `dataclasses` padrão por `pydantic.dataclasses`, que é um substituto direto:
{* ../../docs_src/dataclasses/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *} {* ../../docs_src/dataclasses_/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *}
1. Ainda importamos `field` das `dataclasses` padrão. 1. Ainda importamos `field` das `dataclasses` padrão.

2
docs/pt/docs/how-to/graphql.md

@ -35,7 +35,7 @@ Dependendo do seu caso de uso, você pode preferir usar uma biblioteca diferente
Aqui está uma pequena prévia de como você poderia integrar Strawberry com FastAPI: Aqui está uma pequena prévia de como você poderia integrar Strawberry com FastAPI:
{* ../../docs_src/graphql/tutorial001_py39.py hl[3,22,25] *} {* ../../docs_src/graphql_/tutorial001_py39.py hl[3,22,25] *}
Você pode aprender mais sobre Strawberry na <a href="https://strawberry.rocks/" class="external-link" target="_blank">documentação do Strawberry</a>. Você pode aprender mais sobre Strawberry na <a href="https://strawberry.rocks/" class="external-link" target="_blank">documentação do Strawberry</a>.

6
docs/ru/docs/advanced/dataclasses.md

@ -4,7 +4,7 @@ FastAPI построен поверх **Pydantic**, и я показывал в
Но FastAPI также поддерживает использование <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> тем же способом: Но FastAPI также поддерживает использование <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> тем же способом:
{* ../../docs_src/dataclasses/tutorial001_py310.py hl[1,6:11,18:19] *} {* ../../docs_src/dataclasses_/tutorial001_py310.py hl[1,6:11,18:19] *}
Это по-прежнему поддерживается благодаря **Pydantic**, так как в нём есть <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">встроенная поддержка `dataclasses`</a>. Это по-прежнему поддерживается благодаря **Pydantic**, так как в нём есть <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">встроенная поддержка `dataclasses`</a>.
@ -32,7 +32,7 @@ FastAPI построен поверх **Pydantic**, и я показывал в
Вы также можете использовать `dataclasses` в параметре `response_model`: Вы также можете использовать `dataclasses` в параметре `response_model`:
{* ../../docs_src/dataclasses/tutorial002_py310.py hl[1,6:12,18] *} {* ../../docs_src/dataclasses_/tutorial002_py310.py hl[1,6:12,18] *}
Этот dataclass будет автоматически преобразован в Pydantic dataclass. Этот dataclass будет автоматически преобразован в Pydantic dataclass.
@ -48,7 +48,7 @@ FastAPI построен поверх **Pydantic**, и я показывал в
В таком случае вы можете просто заменить стандартные `dataclasses` на `pydantic.dataclasses`, которая является полностью совместимой заменой (drop-in replacement): В таком случае вы можете просто заменить стандартные `dataclasses` на `pydantic.dataclasses`, которая является полностью совместимой заменой (drop-in replacement):
{* ../../docs_src/dataclasses/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *} {* ../../docs_src/dataclasses_/tutorial003_py310.py hl[1,4,7:10,13:16,22:24,27] *}
1. Мы по-прежнему импортируем `field` из стандартных `dataclasses`. 1. Мы по-прежнему импортируем `field` из стандартных `dataclasses`.

2
docs/ru/docs/how-to/graphql.md

@ -35,7 +35,7 @@
Вот небольшой пример того, как можно интегрировать Strawberry с FastAPI: Вот небольшой пример того, как можно интегрировать Strawberry с FastAPI:
{* ../../docs_src/graphql/tutorial001_py39.py hl[3,22,25] *} {* ../../docs_src/graphql_/tutorial001_py39.py hl[3,22,25] *}
Подробнее о Strawberry можно узнать в <a href="https://strawberry.rocks/" class="external-link" target="_blank">документации Strawberry</a>. Подробнее о Strawberry можно узнать в <a href="https://strawberry.rocks/" class="external-link" target="_blank">документации Strawberry</a>.

6
docs/zh/docs/advanced/dataclasses.md

@ -4,7 +4,7 @@ FastAPI 基于 **Pydantic** 构建,前文已经介绍过如何使用 Pydantic
但 FastAPI 还可以使用数据类(<a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a>): 但 FastAPI 还可以使用数据类(<a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a>):
{* ../../docs_src/dataclasses/tutorial001.py hl[1,7:12,19:20] *} {* ../../docs_src/dataclasses_/tutorial001.py hl[1,7:12,19:20] *}
这还是借助于 **Pydantic** 及其<a href="https://pydantic-docs.helpmanual.io/usage/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">内置的 `dataclasses`</a> 这还是借助于 **Pydantic** 及其<a href="https://pydantic-docs.helpmanual.io/usage/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">内置的 `dataclasses`</a>
@ -32,7 +32,7 @@ FastAPI 基于 **Pydantic** 构建,前文已经介绍过如何使用 Pydantic
`response_model` 参数中使用 `dataclasses` `response_model` 参数中使用 `dataclasses`
{* ../../docs_src/dataclasses/tutorial002.py hl[1,7:13,19] *} {* ../../docs_src/dataclasses_/tutorial002.py hl[1,7:13,19] *}
本例把数据类自动转换为 Pydantic 数据类。 本例把数据类自动转换为 Pydantic 数据类。
@ -49,7 +49,7 @@ API 文档中也会显示相关概图:
本例把标准的 `dataclasses` 直接替换为 `pydantic.dataclasses` 本例把标准的 `dataclasses` 直接替换为 `pydantic.dataclasses`
```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" } ```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" }
{!../../docs_src/dataclasses/tutorial003.py!} {!../../docs_src/dataclasses_/tutorial003.py!}
``` ```
1. 本例依然要从标准的 `dataclasses` 中导入 `field` 1. 本例依然要从标准的 `dataclasses` 中导入 `field`

0
docs_src/additional_responses/__init__.py

0
docs_src/additional_status_codes/__init__.py

0
docs_src/advanced_middleware/__init__.py

0
docs_src/authentication_error_status_code/__init__.py

0
docs_src/background_tasks/__init__.py

0
docs_src/behind_a_proxy/__init__.py

0
docs_src/body/__init__.py

0
docs_src/body_fields/__init__.py

0
docs_src/body_multiple_params/__init__.py

0
docs_src/body_nested_models/__init__.py

0
docs_src/body_updates/__init__.py

0
docs_src/conditional_openapi/__init__.py

0
docs_src/configure_swagger_ui/__init__.py

0
docs_src/cookie_param_models/__init__.py

0
docs_src/cookie_params/__init__.py

0
docs_src/cors/__init__.py

0
docs_src/custom_docs_ui/__init__.py

0
docs_src/custom_request_and_route/__init__.py

0
docs_src/custom_response/__init__.py

0
docs_src/dataclasses_/__init__.py

0
docs_src/dataclasses/tutorial001_py310.py → docs_src/dataclasses_/tutorial001_py310.py

0
docs_src/dataclasses/tutorial001_py39.py → docs_src/dataclasses_/tutorial001_py39.py

0
docs_src/dataclasses/tutorial002_py310.py → docs_src/dataclasses_/tutorial002_py310.py

0
docs_src/dataclasses/tutorial002_py39.py → docs_src/dataclasses_/tutorial002_py39.py

0
docs_src/dataclasses/tutorial003_py310.py → docs_src/dataclasses_/tutorial003_py310.py

0
docs_src/dataclasses/tutorial003_py39.py → docs_src/dataclasses_/tutorial003_py39.py

0
docs_src/debugging/__init__.py

0
docs_src/dependencies/__init__.py

0
docs_src/dependency_testing/__init__.py

0
docs_src/encoder/__init__.py

0
docs_src/events/__init__.py

0
docs_src/extending_openapi/__init__.py

0
docs_src/extra_data_types/__init__.py

0
docs_src/extra_models/__init__.py

0
docs_src/first_steps/__init__.py

0
docs_src/generate_clients/__init__.py

0
docs_src/graphql_/__init__.py

0
docs_src/graphql/tutorial001_py39.py → docs_src/graphql_/tutorial001_py39.py

0
docs_src/handling_errors/__init__.py

0
docs_src/header_param_models/__init__.py

0
docs_src/header_params/__init__.py

0
docs_src/metadata/__init__.py

0
docs_src/middleware/__init__.py

0
docs_src/openapi_callbacks/__init__.py

0
docs_src/openapi_webhooks/__init__.py

0
docs_src/path_operation_advanced_configuration/__init__.py

0
docs_src/path_operation_configuration/__init__.py

0
docs_src/path_params/__init__.py

0
docs_src/path_params_numeric_validations/__init__.py

0
docs_src/pydantic_v1_in_v2/__init__.py

0
docs_src/python_types/__init__.py

0
docs_src/query_param_models/__init__.py

0
docs_src/query_params/__init__.py

0
docs_src/query_params_str_validations/__init__.py

0
docs_src/request_files/__init__.py

0
docs_src/request_form_models/__init__.py

0
docs_src/request_forms/__init__.py

0
docs_src/request_forms_and_files/__init__.py

0
docs_src/response_change_status_code/__init__.py

0
docs_src/response_cookies/__init__.py

0
docs_src/response_directly/__init__.py

0
docs_src/response_headers/__init__.py

0
docs_src/response_model/__init__.py

0
docs_src/response_status_code/__init__.py

0
docs_src/schema_extra_example/__init__.py

0
docs_src/security/__init__.py

0
docs_src/separate_openapi_schemas/__init__.py

0
docs_src/settings/__init__.py

0
docs_src/static_files/__init__.py

0
docs_src/sub_applications/__init__.py

0
docs_src/templates/__init__.py

0
docs_src/templates/static/__init__.py

0
docs_src/templates/templates/__init__.py

0
docs_src/using_request_directly/__init__.py

0
docs_src/wsgi/__init__.py

2
fastapi/__init__.py

@ -1,6 +1,6 @@
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production""" """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.127.0" __version__ = "0.127.1"
from starlette import status as status from starlette import status as status

7
fastapi/exceptions.py

@ -237,3 +237,10 @@ class PydanticV1NotSupportedError(FastAPIError):
""" """
A pydantic.v1 model is used, which is no longer supported. A pydantic.v1 model is used, which is no longer supported.
""" """
class FastAPIDeprecationWarning(UserWarning):
"""
A custom deprecation warning as DeprecationWarning is ignored
Ref: https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries
"""

5
fastapi/openapi/utils.py

@ -23,6 +23,7 @@ from fastapi.dependencies.utils import (
get_validation_alias, get_validation_alias,
) )
from fastapi.encoders import jsonable_encoder from fastapi.encoders import jsonable_encoder
from fastapi.exceptions import FastAPIDeprecationWarning
from fastapi.openapi.constants import METHODS_WITH_BODY, REF_PREFIX from fastapi.openapi.constants import METHODS_WITH_BODY, REF_PREFIX
from fastapi.openapi.models import OpenAPI from fastapi.openapi.models import OpenAPI
from fastapi.params import Body, ParamTypes from fastapi.params import Body, ParamTypes
@ -215,9 +216,9 @@ def generate_operation_id(
*, route: routing.APIRoute, method: str *, route: routing.APIRoute, method: str
) -> str: # pragma: nocover ) -> str: # pragma: nocover
warnings.warn( warnings.warn(
"fastapi.openapi.utils.generate_operation_id() was deprecated, " message="fastapi.openapi.utils.generate_operation_id() was deprecated, "
"it is not used internally, and will be removed soon", "it is not used internally, and will be removed soon",
DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=2, stacklevel=2,
) )
if route.operation_id: if route.operation_id:

9
fastapi/params.py

@ -4,6 +4,7 @@ from dataclasses import dataclass
from enum import Enum from enum import Enum
from typing import Annotated, Any, Callable, Optional, Union from typing import Annotated, Any, Callable, Optional, Union
from fastapi.exceptions import FastAPIDeprecationWarning
from fastapi.openapi.models import Example from fastapi.openapi.models import Example
from pydantic.fields import FieldInfo from pydantic.fields import FieldInfo
from typing_extensions import Literal, deprecated from typing_extensions import Literal, deprecated
@ -75,7 +76,7 @@ class Param(FieldInfo): # type: ignore[misc]
if example is not _Unset: if example is not _Unset:
warnings.warn( warnings.warn(
"`example` has been deprecated, please use `examples` instead", "`example` has been deprecated, please use `examples` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
self.example = example self.example = example
@ -105,7 +106,7 @@ class Param(FieldInfo): # type: ignore[misc]
if regex is not None: if regex is not None:
warnings.warn( warnings.warn(
"`regex` has been deprecated, please use `pattern` instead", "`regex` has been deprecated, please use `pattern` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
current_json_schema_extra = json_schema_extra or extra current_json_schema_extra = json_schema_extra or extra
@ -530,7 +531,7 @@ class Body(FieldInfo): # type: ignore[misc]
if example is not _Unset: if example is not _Unset:
warnings.warn( warnings.warn(
"`example` has been deprecated, please use `examples` instead", "`example` has been deprecated, please use `examples` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
self.example = example self.example = example
@ -560,7 +561,7 @@ class Body(FieldInfo): # type: ignore[misc]
if regex is not None: if regex is not None:
warnings.warn( warnings.warn(
"`regex` has been deprecated, please use `pattern` instead", "`regex` has been deprecated, please use `pattern` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
current_json_schema_extra = json_schema_extra or extra current_json_schema_extra = json_schema_extra or extra

9
fastapi/temp_pydantic_v1_params.py

@ -1,6 +1,7 @@
import warnings import warnings
from typing import Annotated, Any, Callable, Optional, Union from typing import Annotated, Any, Callable, Optional, Union
from fastapi.exceptions import FastAPIDeprecationWarning
from fastapi.openapi.models import Example from fastapi.openapi.models import Example
from fastapi.params import ParamTypes from fastapi.params import ParamTypes
from typing_extensions import deprecated from typing_extensions import deprecated
@ -63,7 +64,7 @@ class Param(FieldInfo):
if example is not _Unset: if example is not _Unset:
warnings.warn( warnings.warn(
"`example` has been deprecated, please use `examples` instead", "`example` has been deprecated, please use `examples` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
self.example = example self.example = example
@ -93,7 +94,7 @@ class Param(FieldInfo):
if regex is not None: if regex is not None:
warnings.warn( warnings.warn(
"`regex` has been deprecated, please use `pattern` instead", "`regex` has been deprecated, please use `pattern` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
current_json_schema_extra = json_schema_extra or extra current_json_schema_extra = json_schema_extra or extra
@ -503,7 +504,7 @@ class Body(FieldInfo):
if example is not _Unset: if example is not _Unset:
warnings.warn( warnings.warn(
"`example` has been deprecated, please use `examples` instead", "`example` has been deprecated, please use `examples` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
self.example = example self.example = example
@ -533,7 +534,7 @@ class Body(FieldInfo):
if regex is not None: if regex is not None:
warnings.warn( warnings.warn(
"`regex` has been deprecated, please use `pattern` instead", "`regex` has been deprecated, please use `pattern` instead",
category=DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=4, stacklevel=4,
) )
current_json_schema_extra = json_schema_extra or extra current_json_schema_extra = json_schema_extra or extra

5
fastapi/utils.py

@ -23,6 +23,7 @@ from fastapi._compat import (
may_v1, may_v1,
) )
from fastapi.datastructures import DefaultPlaceholder, DefaultType from fastapi.datastructures import DefaultPlaceholder, DefaultType
from fastapi.exceptions import FastAPIDeprecationWarning
from pydantic import BaseModel from pydantic import BaseModel
from pydantic.fields import FieldInfo from pydantic.fields import FieldInfo
from typing_extensions import Literal from typing_extensions import Literal
@ -195,9 +196,9 @@ def generate_operation_id_for_path(
*, name: str, path: str, method: str *, name: str, path: str, method: str
) -> str: # pragma: nocover ) -> str: # pragma: nocover
warnings.warn( warnings.warn(
"fastapi.utils.generate_operation_id_for_path() was deprecated, " message="fastapi.utils.generate_operation_id_for_path() was deprecated, "
"it is not used internally, and will be removed soon", "it is not used internally, and will be removed soon",
DeprecationWarning, category=FastAPIDeprecationWarning,
stacklevel=2, stacklevel=2,
) )
operation_id = f"{name}{path}" operation_id = f"{name}{path}"

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save