From bdc929a92a4528fa3da9e2220c237d6392b263fb Mon Sep 17 00:00:00 2001 From: Nils Lindemann Date: Mon, 1 Apr 2024 20:18:57 +0200 Subject: [PATCH] Better wording --- docs/de/docs/features.md | 2 +- docs/en/docs/advanced/additional-responses.md | 2 +- docs/en/docs/advanced/behind-a-proxy.md | 2 +- docs/en/docs/advanced/custom-response.md | 4 ++-- docs/en/docs/advanced/response-directly.md | 2 +- docs/en/docs/alternatives.md | 2 +- docs/en/docs/features.md | 2 +- docs/en/docs/tutorial/background-tasks.md | 2 +- docs/en/docs/tutorial/body.md | 2 +- docs/en/docs/tutorial/cors.md | 6 +++--- .../docs/tutorial/dependencies/dependencies-with-yield.md | 2 +- docs/en/docs/tutorial/extra-models.md | 6 +++--- docs/en/docs/tutorial/query-params-str-validations.md | 4 ++-- docs/en/docs/tutorial/request-files.md | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/de/docs/features.md b/docs/de/docs/features.md index 76aad9f16..fee975387 100644 --- a/docs/de/docs/features.md +++ b/docs/de/docs/features.md @@ -11,7 +11,7 @@ hide: ### Basiert auf offenen Standards -* OpenAPI für die Erstellung von APIs, inklusive Deklarationen von Pfad-Operationen, Parametern, Body-Anfragen, Sicherheit, usw. +* OpenAPI für die Erstellung von APIs, inklusive Deklarationen von Pfad-Operationen, Parametern, Requestbodys, Sicherheit, usw. * Automatische Dokumentation der Datenmodelle mit JSON Schema (da OpenAPI selbst auf JSON Schema basiert). * Um diese Standards herum entworfen, nach sorgfältigem Studium. Statt einer nachträglichen Schicht darüber. * Dies ermöglicht auch automatische **Client-Code-Generierung** in vielen Sprachen. diff --git a/docs/en/docs/advanced/additional-responses.md b/docs/en/docs/advanced/additional-responses.md index 41b39c18e..fe532bd5b 100644 --- a/docs/en/docs/advanced/additional-responses.md +++ b/docs/en/docs/advanced/additional-responses.md @@ -33,7 +33,7 @@ For example, to declare another response with a status code `404` and a Pydantic !!! info The `model` key is not part of OpenAPI. - **FastAPI** will take the Pydantic model from there, generate the `JSON Schema`, and put it in the correct place. + **FastAPI** will take the Pydantic model from there, generate the JSON Schema, and put it in the correct place. The correct place is: diff --git a/docs/en/docs/advanced/behind-a-proxy.md b/docs/en/docs/advanced/behind-a-proxy.md index 4da2ddefc..cf2b486ec 100644 --- a/docs/en/docs/advanced/behind-a-proxy.md +++ b/docs/en/docs/advanced/behind-a-proxy.md @@ -202,7 +202,7 @@ Now create that other file `routes.toml`: This file configures Traefik to use the path prefix `/api/v1`. -And then it will redirect its requests to your Uvicorn running on `http://127.0.0.1:8000`. +And then Traefik will redirect its requests to your Uvicorn running on `http://127.0.0.1:8000`. Now start Traefik: diff --git a/docs/en/docs/advanced/custom-response.md b/docs/en/docs/advanced/custom-response.md index 827776f5e..0dd0abbb0 100644 --- a/docs/en/docs/advanced/custom-response.md +++ b/docs/en/docs/advanced/custom-response.md @@ -216,11 +216,11 @@ This includes many libraries to interact with cloud storage, video processing, a 1. This is the generator function. It's a "generator function" because it contains `yield` statements inside. 2. By using a `with` block, we make sure that the file-like object is closed after the generator function is done. So, after it finishes sending the response. -3. This `yield from` tells the function to iterate over that thing named `file_like`. And then, for each part iterated, yield that part as coming from this generator function. +3. This `yield from` tells the function to iterate over that thing named `file_like`. And then, for each part iterated, yield that part as coming from this generator function (`iterfile`). So, it is a generator function that transfers the "generating" work to something else internally. - By doing it this way, we can put it in a `with` block, and that way, ensure that it is closed after finishing. + By doing it this way, we can put it in a `with` block, and that way, ensure that the file-like object is closed after finishing. !!! tip Notice that here as we are using standard `open()` that doesn't support `async` and `await`, we declare the path operation with normal `def`. diff --git a/docs/en/docs/advanced/response-directly.md b/docs/en/docs/advanced/response-directly.md index 8836140ec..cc6d2a5c6 100644 --- a/docs/en/docs/advanced/response-directly.md +++ b/docs/en/docs/advanced/response-directly.md @@ -48,7 +48,7 @@ Now, let's see how you could use that to return a custom response. Let's say that you want to return an XML response. -You could put your XML content in a string, put it in a `Response`, and return it: +You could put your XML content in a string, put that in a `Response`, and return it: ```Python hl_lines="1 18" {!../../../docs_src/response_directly/tutorial002.py!} diff --git a/docs/en/docs/alternatives.md b/docs/en/docs/alternatives.md index d351c4e0b..d0351b681 100644 --- a/docs/en/docs/alternatives.md +++ b/docs/en/docs/alternatives.md @@ -298,7 +298,7 @@ As it is based on the previous standard for synchronous Python web frameworks (W Hug inspired **FastAPI** to declare a `response` parameter in functions to set headers and cookies. -### APIStar (<= 0.5) +### APIStar (≦ 0.5) Right before deciding to build **FastAPI** I found **APIStar** server. It had almost everything I was looking for and had a great design. diff --git a/docs/en/docs/features.md b/docs/en/docs/features.md index 6f0e74b3d..1d4817176 100644 --- a/docs/en/docs/features.md +++ b/docs/en/docs/features.md @@ -11,7 +11,7 @@ hide: ### Based on open standards -* OpenAPI for API creation, including declarations of path operations, parameters, body requests, security, etc. +* OpenAPI for API creation, including declarations of path operations, parameters, request bodies, security, etc. * Automatic data model documentation with JSON Schema (as OpenAPI itself is based on JSON Schema). * Designed around these standards, after a meticulous study. Instead of an afterthought layer on top. * This also allows using automatic **client code generation** in many languages. diff --git a/docs/en/docs/tutorial/background-tasks.md b/docs/en/docs/tutorial/background-tasks.md index bc8e2af6a..95f1f0a74 100644 --- a/docs/en/docs/tutorial/background-tasks.md +++ b/docs/en/docs/tutorial/background-tasks.md @@ -9,7 +9,7 @@ This includes, for example: * Email notifications sent after performing an action: * As connecting to an email server and sending an email tends to be "slow" (several seconds), you can return the response right away and send the email notification in the background. * Processing data: - * For example, let's say you receive a file that must go through a slow process, you can return a response of "Accepted" (HTTP 202) and process it in the background. + * For example, let's say you receive a file that must go through a slow process, you can return a response of "Accepted" (HTTP 202) and process the file in the background. ## Using `BackgroundTasks` diff --git a/docs/en/docs/tutorial/body.md b/docs/en/docs/tutorial/body.md index f9af42938..79726dc00 100644 --- a/docs/en/docs/tutorial/body.md +++ b/docs/en/docs/tutorial/body.md @@ -4,7 +4,7 @@ When you need to send data from a client (let's say, a browser) to your API, you A **request** body is data sent by the client to your API. A **response** body is the data your API sends to the client. -Your API almost always has to send a **response** body. But clients don't necessarily need to send **request** bodies all the time. +Your API almost always has to send a **response** body. But clients don't necessarily need to send **request** bodies all the time. (Just metadata instead) To declare a **request** body, you use Pydantic models with all their power and benefits. diff --git a/docs/en/docs/tutorial/cors.md b/docs/en/docs/tutorial/cors.md index 33b11983b..5e86486c9 100644 --- a/docs/en/docs/tutorial/cors.md +++ b/docs/en/docs/tutorial/cors.md @@ -18,11 +18,11 @@ Even if they are all in `localhost`, they use different protocols or ports, so, So, let's say you have a frontend running in your browser at `http://localhost:8080`, and its JavaScript is trying to communicate with a backend running at `http://localhost` (because we don't specify a port, the browser will assume the default port `80`). -Then, the browser will send an HTTP `OPTIONS` request to the backend, and if the backend sends the appropriate headers authorizing the communication from this different origin (`http://localhost:8080`) then the browser will let the JavaScript in the frontend send its request to the backend. +Then, the browser will send an HTTP `OPTIONS` request to the `:80`-backend, and if the backend sends the appropriate headers authorizing the communication from this different origin (`http://localhost:8080`) then the `:8080`-browser will let the JavaScript in the frontend send its request to the `:80`-backend. -To achieve this, the backend must have a list of "allowed origins". +To achieve this, the `:80`-backend must have a list of "allowed origins". -In this case, it would have to include `http://localhost:8080` for the frontend to work correctly. +In this case, the list would have to include `http://localhost:8080` for the `:8080`-frontend to work correctly. ## Wildcards diff --git a/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md b/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md index ad5aed932..a656a718a 100644 --- a/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md +++ b/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md @@ -5,7 +5,7 @@ FastAPI supports dependencies that do some `SpooledTemporaryFile` (a file-like object). This is the actual Python file that you can pass directly to other functions or libraries that expect a "file-like" object. +* `file`: A `SpooledTemporaryFile` (a file-like object). This is the actual Python file object that you can pass directly to other functions or libraries that expect a "file-like" object. `UploadFile` has the following `async` methods. They all call the corresponding file methods underneath (using the internal `SpooledTemporaryFile`).