]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Fix and Improve English Documentation (#14048)
authorNils-Hero Lindemann <nilsherolindemann@proton.me>
Sat, 20 Sep 2025 12:58:04 +0000 (14:58 +0200)
committerGitHub <noreply@github.com>
Sat, 20 Sep 2025 12:58:04 +0000 (14:58 +0200)
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
13 files changed:
docs/en/docs/advanced/async-tests.md
docs/en/docs/advanced/custom-response.md
docs/en/docs/advanced/response-headers.md
docs/en/docs/advanced/websockets.md
docs/en/docs/deployment/docker.md
docs/en/docs/features.md
docs/en/docs/how-to/custom-docs-ui-assets.md
docs/en/docs/tutorial/body-multiple-params.md
docs/en/docs/tutorial/debugging.md
docs/en/docs/tutorial/middleware.md
docs/en/docs/tutorial/path-params-numeric-validations.md
docs/en/docs/tutorial/query-params-str-validations.md
docs/en/docs/tutorial/sql-databases.md

index 7b6f083711e0d82cb2bb51c8c39a9a8bda428aa8..e920e22c3c0420bd902ec4fb1f9614b2601fd356 100644 (file)
@@ -94,6 +94,6 @@ As the testing function is now asynchronous, you can now also call (and `await`)
 
 /// tip
 
-If you encounter a `RuntimeError: Task attached to a different loop` when integrating asynchronous function calls in your tests (e.g. when using <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDB's MotorClient</a>), remember to instantiate objects that need an event loop only within async functions, e.g. an `'@app.on_event("startup")` callback.
+If you encounter a `RuntimeError: Task attached to a different loop` when integrating asynchronous function calls in your tests (e.g. when using <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDB's MotorClient</a>), remember to instantiate objects that need an event loop only within async functions, e.g. an `@app.on_event("startup")` callback.
 
 ///
index 5473d939ce5950d3cc4dce37e51892346856b495..0f3d8b7017999bbf99641ed2e56d033868c1bfea 100644 (file)
@@ -221,7 +221,7 @@ Takes an async generator or a normal generator/iterator and streams the response
 
 #### Using `StreamingResponse` with file-like objects { #using-streamingresponse-with-file-like-objects }
 
-If you have a file-like object (e.g. the object returned by `open()`), you can create a generator function to iterate over that file-like object.
+If you have a <a href="https://docs.python.org/3/glossary.html#term-file-like-object" class="external-link" target="_blank">file-like</a> object (e.g. the object returned by `open()`), you can create a generator function to iterate over that file-like object.
 
 That way, you don't have to read it all first in memory, and you can pass that generator function to the `StreamingResponse`, and return it.
 
index 98747eabdadfc7e7fa039f2b7b933546df3c9ded..19c9ff2adc12a18c49fbffd116983c06133d4ae0 100644 (file)
@@ -36,6 +36,6 @@ And as the `Response` can be used frequently to set headers and cookies, **FastA
 
 ## Custom Headers { #custom-headers }
 
-Keep in mind that custom proprietary headers can be added <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">using the 'X-' prefix</a>.
+Keep in mind that custom proprietary headers can be added <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">using the `X-` prefix</a>.
 
 But if you have custom headers that you want a client in a browser to be able to see, you need to add them to your CORS configurations (read more in [CORS (Cross-Origin Resource Sharing)](../tutorial/cors.md){.internal-link target=_blank}), using the parameter `expose_headers` documented in <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette's CORS docs</a>.
index 4ba24637fbef8b30975952603a7900faa597c617..917dd79bd7ab5a6e8fc32b568cfc42df441a5f3a 100644 (file)
@@ -2,9 +2,9 @@
 
 You can use <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API" class="external-link" target="_blank">WebSockets</a> with **FastAPI**.
 
-## Install `WebSockets` { #install-websockets }
+## Install `websockets` { #install-websockets }
 
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and install `websockets`:
+Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and install `websockets` (a Python library that makes it easy to use the "WebSocket" protocol):
 
 <div class="termy">
 
index a1de2dc46bd65445fd712a7af2a073eb297a295e..6b71f7360d996f823da69e51e282081482f3b0bf 100644 (file)
@@ -490,7 +490,7 @@ And normally this **load balancer** would be able to handle requests that go to
 
 In this type of scenario, you probably would want to have **a single (Uvicorn) process per container**, as you would already be handling replication at the cluster level.
 
-So, in this case, you **would not** want to have a multiple workers in the container, for example with the `--workers` command line option.You would want to have just a **single Uvicorn process** per container (but probably multiple containers).
+So, in this case, you **would not** want to have a multiple workers in the container, for example with the `--workers` command line option. You would want to have just a **single Uvicorn process** per container (but probably multiple containers).
 
 Having another process manager inside the container (as would be with multiple workers) would only add **unnecessary complexity** that you are most probably already taking care of with your cluster system.
 
index 681caac35fd4a66db22b22f735a13e91cc7efa84..d44d7a6aca077efe98a5613db31ded9b17211a91 100644 (file)
@@ -190,7 +190,7 @@ With **FastAPI** you get all of **Pydantic**'s features (as FastAPI is based on
 * **No brainfuck**:
     * No new schema definition micro-language to learn.
     * If you know Python types you know how to use Pydantic.
-* Plays nicely with your **<abbr title="Integrated Development Environment, similar to a code editor">IDE</abbr>/<abbr title="A program that checks for code errors">linter</abbr>/brain**:
+* Plays nicely with your **<abbr title="Integrated Development Environment: similar to a code editor">IDE</abbr>/<abbr title="A program that checks for code errors">linter</abbr>/brain**:
     * Because pydantic data structures are just instances of classes you define; auto-completion, linting, mypy and your intuition should all work properly with your validated data.
 * Validate **complex structures**:
     * Use of hierarchical Pydantic models, Python `typing`’s `List` and `Dict`, etc.
index b38c4ec02e977f6a39d308845ac88260ab102d83..91228c8c930bba3c322897e9c8144c7b73f3ee04 100644 (file)
@@ -89,7 +89,7 @@ Your new file structure could look like this:
 
 Download the static files needed for the docs and put them on that `static/` directory.
 
-You can probably right-click each link and select an option similar to `Save link as...`.
+You can probably right-click each link and select an option similar to "Save link as...".
 
 **Swagger UI** uses the files:
 
index ab6d7461a7d5cf5c10500043a7d6d5ca97bb036e..ed23c814900e2fe378e09c92be1edad244862029 100644 (file)
@@ -119,7 +119,7 @@ For example:
 
 /// info
 
-`Body` also has all the same extra validation and metadata parameters as `Query`,`Path` and others you will see later.
+`Body` also has all the same extra validation and metadata parameters as `Query`, `Path` and others you will see later.
 
 ///
 
index a096763f05b1e33f35ebc0cd3c610ecfbb529d0c..08b440084ed1654d2ae2b974e53555b09b3357bd 100644 (file)
@@ -62,7 +62,7 @@ from myapp import app
 # Some more code
 ```
 
-in that case, the automatically created variable inside of `myapp.py` will not have the variable `__name__` with a value of `"__main__"`.
+in that case, the automatically created variable `__name__` inside of `myapp.py` will not have the value `"__main__"`.
 
 So, the line:
 
index 9bfbf47c920b0b1ba59239b0b599a02823f5d730..bc0519c6792f59119b649fde8087fe73eea1a74a 100644 (file)
@@ -35,7 +35,7 @@ The middleware function receives:
 
 /// tip
 
-Keep in mind that custom proprietary headers can be added <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">using the 'X-' prefix</a>.
+Keep in mind that custom proprietary headers can be added <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">using the `X-` prefix</a>.
 
 But if you have custom headers that you want a client in a browser to be able to see, you need to add them to your CORS configurations ([CORS (Cross-Origin Resource Sharing)](cors.md){.internal-link target=_blank}) using the parameter `expose_headers` documented in <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette's CORS docs</a>.
 
index 435606bbfbd5527bea6aab836d83e0497ac747aa..ef1caea426406e879ba12ac15f5014b0d52261aa 100644 (file)
@@ -2,7 +2,7 @@
 
 In the same way that you can declare more validations and metadata for query parameters with `Query`, you can declare the same type of validations and metadata for path parameters with `Path`.
 
-## Import Path { #import-path }
+## Import `Path` { #import-path }
 
 First, import `Path` from `fastapi`, and import `Annotated`:
 
index a55b4cfb0196bf70cddfc34d05523bd446c2d996..adf08a9249e931d805e27ea40da19e8337f7bad9 100644 (file)
@@ -250,14 +250,10 @@ q: str | None = None
 
 But we are now declaring it with `Query`, for example like:
 
-//// tab | Annotated
-
 ```Python
 q: Annotated[str | None, Query(min_length=3)] = None
 ```
 
-////
-
 So, when you need to declare a value as required while using `Query`, you can simply not declare a default value:
 
 {* ../../docs_src/query_params_str_validations/tutorial006_an_py39.py hl[9] *}
index 79538e566a839dfc1eda49bc9c2be62f02135a3e..cfa1c9073fe25862648ce7145615fc0b12022363 100644 (file)
@@ -8,7 +8,7 @@ Here we'll see an example using <a href="https://sqlmodel.tiangolo.com/" class="
 
 /// tip
 
-You could use any other SQL or NoSQL database library you want (in some cases called <abbr title="Object Relational Mapper, a fancy term for a library where some classes represent SQL tables and instances represent rows in those tables">"ORMs"</abbr>), FastAPI doesn't force you to use anything. 😎
+You could use any other SQL or NoSQL database library you want (in some cases called <abbr title="Object Relational Mapper: a fancy term for a library where some classes represent SQL tables and instances represent rows in those tables">"ORMs"</abbr>), FastAPI doesn't force you to use anything. 😎
 
 ///