]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Fix minor typos and issues in the documentation (#12063)
authorSofie Van Landeghem <svlandeg@users.noreply.github.com>
Sat, 24 Aug 2024 21:52:09 +0000 (23:52 +0200)
committerGitHub <noreply@github.com>
Sat, 24 Aug 2024 21:52:09 +0000 (16:52 -0500)
19 files changed:
README.md
docs/en/docs/advanced/response-directly.md
docs/en/docs/async.md
docs/en/docs/index.md
docs/en/docs/python-types.md
docs/en/docs/tutorial/bigger-applications.md
docs/en/docs/tutorial/body-multiple-params.md
docs/en/docs/tutorial/body-updates.md
docs/en/docs/tutorial/body.md
docs/en/docs/tutorial/cors.md
docs/en/docs/tutorial/dependencies/classes-as-dependencies.md
docs/en/docs/tutorial/extra-data-types.md
docs/en/docs/tutorial/handling-errors.md
docs/en/docs/tutorial/index.md
docs/en/docs/tutorial/middleware.md
docs/en/docs/tutorial/query-params-str-validations.md
docs/en/docs/tutorial/schema-extra-example.md
docs/en/docs/tutorial/security/first-steps.md
docs/en/docs/tutorial/security/get-current-user.md

index 889a89ed734dcec9f551c341ce44b6ed8ab8919b..ec7a95497825b9207c07ee0e4f1c4c33e13d63ff 100644 (file)
--- a/README.md
+++ b/README.md
@@ -394,7 +394,7 @@ Coming back to the previous code example, **FastAPI** will:
 * Check if there is an optional query parameter named `q` (as in `http://127.0.0.1:8000/items/foo?q=somequery`) for `GET` requests.
     * As the `q` parameter is declared with `= None`, it is optional.
     * Without the `None` it would be required (as is the body in the case with `PUT`).
-* For `PUT` requests to `/items/{item_id}`, Read the body as JSON:
+* For `PUT` requests to `/items/{item_id}`, read the body as JSON:
     * Check that it has a required attribute `name` that should be a `str`.
     * Check that it has a required attribute `price` that has to be a `float`.
     * Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.
index 73071ed1b0a1dd04a1d7e220dee1ee99d9307938..2251659c55a92ae7a026d1ce76e8bbc57a8c9910 100644 (file)
@@ -28,7 +28,7 @@ This gives you a lot of flexibility. You can return any data type, override any
 
 ## Using the `jsonable_encoder` in a `Response`
 
-Because **FastAPI** doesn't do any change to a `Response` you return, you have to make sure it's contents are ready for it.
+Because **FastAPI** doesn't do any change to a `Response` you return, you have to make sure its contents are ready for it.
 
 For example, you cannot put a Pydantic model in a `JSONResponse` without first converting it to a `dict` with all the data types (like `datetime`, `UUID`, etc) converted to JSON-compatible types.
 
index 7cf4af6277e7ae4f90c1295300a9660e15c05b2e..752a5c247dfd91ef0ddca5101d4260b94c7a381a 100644 (file)
@@ -292,7 +292,7 @@ For example:
 
 ### Concurrency + Parallelism: Web + Machine Learning
 
-With **FastAPI** you can take the advantage of concurrency that is very common for web development (the same main attraction of NodeJS).
+With **FastAPI** you can take advantage of concurrency that is very common for web development (the same main attraction of NodeJS).
 
 But you can also exploit the benefits of parallelism and multiprocessing (having multiple processes running in parallel) for **CPU bound** workloads like those in Machine Learning systems.
 
index ac4f4d00f3e365f862673a20b6d27b1174e643ae..3ed3d7bf6c4dff6f4f2ff49925476fb394d9bbf0 100644 (file)
@@ -390,7 +390,7 @@ Coming back to the previous code example, **FastAPI** will:
 * Check if there is an optional query parameter named `q` (as in `http://127.0.0.1:8000/items/foo?q=somequery`) for `GET` requests.
     * As the `q` parameter is declared with `= None`, it is optional.
     * Without the `None` it would be required (as is the body in the case with `PUT`).
-* For `PUT` requests to `/items/{item_id}`, Read the body as JSON:
+* For `PUT` requests to `/items/{item_id}`, read the body as JSON:
     * Check that it has a required attribute `name` that should be a `str`.
     * Check that it has a required attribute `price` that has to be a `float`.
     * Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.
index 4ed1fc6804bd07ab202f0cedc4696394d8751ca3..6994adb5faac3ab5258f54fb3905d0c0f7bb5561 100644 (file)
@@ -324,7 +324,7 @@ In Python 3.6 and above (including Python 3.10) you can declare it by importing
 {!../../../docs_src/python_types/tutorial009.py!}
 ```
 
-Using `Optional[str]` instead of just `str` will let the editor help you detecting errors where you could be assuming that a value is always a `str`, when it could actually be `None` too.
+Using `Optional[str]` instead of just `str` will let the editor help you detect errors where you could be assuming that a value is always a `str`, when it could actually be `None` too.
 
 `Optional[Something]` is actually a shortcut for `Union[Something, None]`, they are equivalent.
 
index 97f6b205bb480e0993447e9895d28663571d7529..230f9c08c76b89e346e25bac78bb363007174a73 100644 (file)
@@ -1,6 +1,6 @@
 # Bigger Applications - Multiple Files
 
-If you are building an application or a web API, it's rarely the case that you can put everything on a single file.
+If you are building an application or a web API, it's rarely the case that you can put everything in a single file.
 
 **FastAPI** provides a convenience tool to structure your application while keeping all the flexibility.
 
@@ -478,7 +478,7 @@ We can declare all that without having to modify the original `APIRouter` by pas
 {!../../../docs_src/bigger_applications/app/main.py!}
 ```
 
-That way, the original `APIRouter` will keep unmodified, so we can still share that same `app/internal/admin.py` file with other projects in the organization.
+That way, the original `APIRouter` will stay unmodified, so we can still share that same `app/internal/admin.py` file with other projects in the organization.
 
 The result is that in our app, each of the *path operations* from the `admin` module will have:
 
index 511fb358e6bebc07ad9d96981a7de140b22cecac..d63cd2529bd4729301003ada07abe290240c7236 100644 (file)
@@ -97,7 +97,7 @@ But you can also declare multiple body parameters, e.g. `item` and `user`:
 
 ////
 
-In this case, **FastAPI** will notice that there are more than one body parameters in the function (two parameters that are Pydantic models).
+In this case, **FastAPI** will notice that there is more than one body parameter in the function (there are two parameters that are Pydantic models).
 
 So, it will then use the parameter names as keys (field names) in the body, and expect a body like:
 
index 261f44d333aa45f82e989ac6789ec9197349779d..3257f9a08224df12f17cb739bf6250e99d7a6534 100644 (file)
@@ -155,7 +155,7 @@ In summary, to apply partial updates you would:
 * Put that data in a Pydantic model.
 * Generate a `dict` without default values from the input model (using `exclude_unset`).
     * This way you can update only the values actually set by the user, instead of overriding values already stored with default values in your model.
-* Create a copy of the stored model, updating it's attributes with the received partial updates (using the `update` parameter).
+* Create a copy of the stored model, updating its attributes with the received partial updates (using the `update` parameter).
 * Convert the copied model to something that can be stored in your DB (for example, using the `jsonable_encoder`).
     * This is comparable to using the model's `.model_dump()` method again, but it makes sure (and converts) the values to data types that can be converted to JSON, for example, `datetime` to `str`.
 * Save the data to your DB.
index 608b50dbb095a6279a6fdb49acc1e70643bc2545..83f08ce84f4099526e1341926577bfcf6e9e1a6c 100644 (file)
@@ -123,7 +123,7 @@ The JSON Schemas of your models will be part of your OpenAPI generated schema, a
 
 <img src="/img/tutorial/body/image01.png">
 
-And will be also used in the API docs inside each *path operation* that needs them:
+And will also be used in the API docs inside each *path operation* that needs them:
 
 <img src="/img/tutorial/body/image02.png">
 
index fd329e138d1e06b3e87404527f9e7ff51391bf20..7dd0a5df5831c7557cc60d762d6b5e39fe0f6084 100644 (file)
@@ -40,7 +40,7 @@ You can configure it in your **FastAPI** application using the `CORSMiddleware`.
 * Create a list of allowed origins (as strings).
 * Add it as a "middleware" to your **FastAPI** application.
 
-You can also specify if your backend allows:
+You can also specify whether your backend allows:
 
 * Credentials (Authorization headers, Cookies, etc).
 * Specific HTTP methods (`POST`, `PUT`) or all of them with the wildcard `"*"`.
index a392672bbf60e882f042a615dc7ce82feb7318b1..b3394f14e7c255edded7e35eb9d6c09449e0070a 100644 (file)
@@ -381,7 +381,7 @@ The last `CommonQueryParams`, in:
 
 ...is what **FastAPI** will actually use to know what is the dependency.
 
-From it is that FastAPI will extract the declared parameters and that is what FastAPI will actually call.
+It is from this one that FastAPI will extract the declared parameters and that is what FastAPI will actually call.
 
 ---
 
index 849dee41fd23823134eeb6c260bc43b7278ec505..3009acaf32ae5bad96d8429018b3f4874113fda9 100644 (file)
@@ -49,7 +49,7 @@ Here are some of the additional data types you can use:
 * `Decimal`:
     * Standard Python `Decimal`.
     * In requests and responses, handled the same as a `float`.
-* You can check all the valid pydantic data types here: <a href="https://docs.pydantic.dev/latest/usage/types/types/" class="external-link" target="_blank">Pydantic data types</a>.
+* You can check all the valid Pydantic data types here: <a href="https://docs.pydantic.dev/latest/usage/types/types/" class="external-link" target="_blank">Pydantic data types</a>.
 
 ## Example
 
index ca3cff661e4eb72f975d4d6b9b447d9ccc4da33f..14a3cf998d10d54bda0966312fe815fa38c4b047 100644 (file)
@@ -176,7 +176,7 @@ These are technical details that you might skip if it's not important for you no
 
 **FastAPI** uses it so that, if you use a Pydantic model in `response_model`, and your data has an error, you will see the error in your log.
 
-But the client/user will not see it. Instead, the client will receive an "Internal Server Error" with a HTTP status code `500`.
+But the client/user will not see it. Instead, the client will receive an "Internal Server Error" with an HTTP status code `500`.
 
 It should be this way because if you have a Pydantic `ValidationError` in your *response* or anywhere in your code (not in the client's *request*), it's actually a bug in your code.
 
@@ -262,7 +262,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 
 ### Reuse **FastAPI**'s exception handlers
 
-If you want to use the exception along with the same default exception handlers from  **FastAPI**, You can import and reuse the default exception handlers from `fastapi.exception_handlers`:
+If you want to use the exception along with the same default exception handlers from  **FastAPI**, you can import and reuse the default exception handlers from `fastapi.exception_handlers`:
 
 ```Python hl_lines="2-5  15  21"
 {!../../../docs_src/handling_errors/tutorial006.py!}
index 386fe5de9da495c0267790220e12e837eb33c50a..bf613aacef357a485244b7ab8bb8da0b847744f7 100644 (file)
@@ -95,7 +95,7 @@ If you don't want to have those optional dependencies, you can instead install `
 
 There is also an **Advanced User Guide** that you can read later after this **Tutorial - User guide**.
 
-The **Advanced User Guide**, builds on this, uses the same concepts, and teaches you some extra features.
+The **Advanced User Guide** builds on this one, uses the same concepts, and teaches you some extra features.
 
 But you should first read the **Tutorial - User Guide** (what you are reading right now).
 
index f0b3faf3b621833ce9050e676e986482904f35d6..06fb3f504eca66feb42a278b34d8eb9d4d6d8094 100644 (file)
@@ -29,7 +29,7 @@ The middleware function receives:
 * A function `call_next` that will receive the `request` as a parameter.
     * This function will pass the `request` to the corresponding *path operation*.
     * Then it returns the `response` generated by the corresponding *path operation*.
-* You can then modify further the `response` before returning it.
+* You can then further modify the `response` before returning it.
 
 ```Python hl_lines="8-9  11  14"
 {!../../../docs_src/middleware/tutorial001.py!}
index 859242d93988ab316c677df3b6826edded412028..dd101a2a644bfe734f9de8e103978ae3a45704bd 100644 (file)
@@ -273,7 +273,7 @@ The **default** value of the **function parameter** is the **actual default** va
 
 You could **call** that same function in **other places** without FastAPI, and it would **work as expected**. If there's a **required** parameter (without a default value), your **editor** will let you know with an error, **Python** will also complain if you run it without passing the required parameter.
 
-When you don't use `Annotated` and instead use the **(old) default value style**, if you call that function without FastAPI in **other place**, you have to **remember** to pass the arguments to the function for it to work correctly, otherwise the values will be different from what you expect (e.g. `QueryInfo` or something similar instead of `str`). And your editor won't complain, and Python won't complain running that function, only when the operations inside error out.
+When you don't use `Annotated` and instead use the **(old) default value style**, if you call that function without FastAPI in **other places**, you have to **remember** to pass the arguments to the function for it to work correctly, otherwise the values will be different from what you expect (e.g. `QueryInfo` or something similar instead of `str`). And your editor won't complain, and Python won't complain running that function, only when the operations inside error out.
 
 Because `Annotated` can have more than one metadata annotation, you could now even use the same function with other tools, like <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">Typer</a>. 🚀
 
@@ -645,7 +645,7 @@ Remember that in most of the cases, when something is required, you can simply o
 
 ## Query parameter list / multiple values
 
-When you define a query parameter explicitly with `Query` you can also declare it to receive a list of values, or said in other way, to receive multiple values.
+When you define a query parameter explicitly with `Query` you can also declare it to receive a list of values, or said in another way, to receive multiple values.
 
 For example, to declare a query parameter `q` that can appear multiple times in the URL, you can write:
 
@@ -1182,4 +1182,4 @@ Validations specific for strings:
 
 In these examples you saw how to declare validations for `str` values.
 
-See the next chapters to see how to declare validations for other types, like numbers.
+See the next chapters to learn how to declare validations for other types, like numbers.
index 70745b04876b7570ef7d62eadf584146bc89714d..20dee3a4fc147fc7bb501c45f1b2c0bd739126dd 100644 (file)
@@ -347,7 +347,7 @@ If the ideas above already work for you, that might be enough, and you probably
 
 Before OpenAPI 3.1.0, OpenAPI used an older and modified version of **JSON Schema**.
 
-JSON Schema didn't have `examples`, so OpenAPI added it's own `example` field to its own modified version.
+JSON Schema didn't have `examples`, so OpenAPI added its own `example` field to its own modified version.
 
 OpenAPI also added `example` and `examples` fields to other parts of the specification:
 
index 4bd026caf37132ad9510d63c12e4345d54f479a5..d1fe0163e8e5c18889d01bb4a616683ed76b63ec 100644 (file)
@@ -152,7 +152,7 @@ A "bearer" token is not the only option.
 
 But it's the best one for our use case.
 
-And it might be the best for most use cases, unless you are an OAuth2 expert and know exactly why there's another option that suits better your needs.
+And it might be the best for most use cases, unless you are an OAuth2 expert and know exactly why there's another option that better suits your needs.
 
 In that case, **FastAPI** also provides you with the tools to build it.
 
index 6f3bf3944258ab04089338cbdd39e5c94d39e9d1..7faaa3e13bac80da8e94c09ab8f9d489279e5ba4 100644 (file)
@@ -316,7 +316,7 @@ And you can make it as complex as you want. And still, have it written only once
 
 But you can have thousands of endpoints (*path operations*) using the same security system.
 
-And all of them (or any portion of them that you want) can take the advantage of re-using these dependencies or any other dependencies you create.
+And all of them (or any portion of them that you want) can take advantage of re-using these dependencies or any other dependencies you create.
 
 And all these thousands of *path operations* can be as small as 3 lines: