]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update docs, simplify usage of admonitions, only default ones (#15553)
authorSebastián Ramírez <tiangolo@gmail.com>
Mon, 18 May 2026 11:55:19 +0000 (13:55 +0200)
committerGitHub <noreply@github.com>
Mon, 18 May 2026 11:55:19 +0000 (13:55 +0200)
58 files changed:
docs/en/docs/_llm-test.md
docs/en/docs/advanced/additional-responses.md
docs/en/docs/advanced/advanced-dependencies.md
docs/en/docs/advanced/custom-response.md
docs/en/docs/advanced/dataclasses.md
docs/en/docs/advanced/events.md
docs/en/docs/advanced/openapi-webhooks.md
docs/en/docs/advanced/response-directly.md
docs/en/docs/advanced/security/oauth2-scopes.md
docs/en/docs/advanced/stream-data.md
docs/en/docs/advanced/strict-content-type.md
docs/en/docs/advanced/websockets.md
docs/en/docs/advanced/wsgi.md
docs/en/docs/alternatives.md
docs/en/docs/async.md
docs/en/docs/deployment/docker.md
docs/en/docs/deployment/server-workers.md
docs/en/docs/external-links.md
docs/en/docs/features.md
docs/en/docs/help-fastapi.md
docs/en/docs/how-to/extending-openapi.md
docs/en/docs/how-to/separate-openapi-schemas.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-nested-models.md
docs/en/docs/tutorial/body.md
docs/en/docs/tutorial/cookie-param-models.md
docs/en/docs/tutorial/cookie-params.md
docs/en/docs/tutorial/debugging.md
docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
docs/en/docs/tutorial/dependencies/index.md
docs/en/docs/tutorial/dependencies/sub-dependencies.md
docs/en/docs/tutorial/first-steps.md
docs/en/docs/tutorial/header-params.md
docs/en/docs/tutorial/metadata.md
docs/en/docs/tutorial/path-operation-configuration.md
docs/en/docs/tutorial/path-params-numeric-validations.md
docs/en/docs/tutorial/path-params.md
docs/en/docs/tutorial/query-params-str-validations.md
docs/en/docs/tutorial/query-params.md
docs/en/docs/tutorial/request-files.md
docs/en/docs/tutorial/request-form-models.md
docs/en/docs/tutorial/request-forms-and-files.md
docs/en/docs/tutorial/request-forms.md
docs/en/docs/tutorial/response-model.md
docs/en/docs/tutorial/response-status-code.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
docs/en/docs/tutorial/security/oauth2-jwt.md
docs/en/docs/tutorial/security/simple-oauth2.md
docs/en/docs/tutorial/server-sent-events.md
docs/en/docs/tutorial/stream-json-lines.md
docs/en/docs/tutorial/testing.md
docs/en/docs/virtual-environments.md
docs/en/mkdocs.yml

index cc9cb48fbac8752aaf2af98fd6cacf6b10d53423..2b548064d3f019cabfba7120467119665a76f1d9 100644 (file)
@@ -124,10 +124,6 @@ See section `### Content of code blocks` in the general prompt in `scripts/trans
 
 //// tab | Test
 
-/// info
-Some text
-///
-
 /// note
 Some text
 ///
@@ -136,10 +132,6 @@ Some text
 Some text
 ///
 
-/// check
-Some text
-///
-
 /// tip
 Some text
 ///
index 577c06daa5ceae76ce37a934499f428424f40cac..494143b07accadec17b9ba7142190a1d05b03bdf 100644 (file)
@@ -34,7 +34,7 @@ Keep in mind that you have to return the `JSONResponse` directly.
 
 ///
 
-/// info
+/// note
 
 The `model` key is not part of OpenAPI.
 
@@ -183,7 +183,7 @@ Notice that you have to return the image using a `FileResponse` directly.
 
 ///
 
-/// info
+/// note
 
 Unless you specify a different media type explicitly in your `responses` parameter, FastAPI will assume the response has the same media type as the main response class (default `application/json`).
 
index 6c940f5a9b64e0233ff8f1df03e190de0097194b..59ab62bf005f486608cbe6658238b920da471891 100644 (file)
@@ -98,7 +98,7 @@ For example, if you had a database session in a dependency with `yield`, the `St
 
 This behavior was reverted in 0.118.0, to make the exit code after `yield` be executed after the response is sent.
 
-/// info
+/// note
 
 As you will see below, this is very similar to the behavior before version 0.106.0, but with several improvements and bug fixes for corner cases.
 
index 0dcb575176d173c162cf4161bcc09f38662ff576..016868fe70b36998e9d0ccac33115ebede45d950 100644 (file)
@@ -41,7 +41,7 @@ To return a response with HTML directly from **FastAPI**, use `HTMLResponse`.
 
 {* ../../docs_src/custom_response/tutorial002_py310.py hl[2,7] *}
 
-/// info
+/// note
 
 The parameter `response_class` will also be used to define the "media type" of the response.
 
@@ -65,7 +65,7 @@ A `Response` returned directly by your *path operation function* won't be docume
 
 ///
 
-/// info
+/// note
 
 Of course, the actual `Content-Type` header, status code, etc, will come from the `Response` object you returned.
 
index 52fe4ae7c83bd84e4f09d7387214d5b617757929..292dc3fba94dc879ac7eb8108d2b306a9db9733b 100644 (file)
@@ -18,7 +18,7 @@ And of course, it supports the same:
 
 This works the same way as with Pydantic models. And it is actually achieved in the same way underneath, using Pydantic.
 
-/// info
+/// note
 
 Keep in mind that dataclasses can't do everything Pydantic models can do.
 
index 820f06d55b7cfb292caa204ba714779e4e65c1cb..3e65854e7b3461b767fcc60d95299a0cbc06f991 100644 (file)
@@ -120,7 +120,7 @@ To add a function that should be run when the application is shutting down, decl
 
 Here, the `shutdown` event handler function will write a text line `"Application shutdown"` to a file `log.txt`.
 
-/// info
+/// note
 
 In the `open()` function, the `mode="a"` means "append", so, the line will be added after whatever is on that file, without overwriting the previous contents.
 
@@ -152,7 +152,7 @@ Just a technical detail for the curious nerds. 🤓
 
 Underneath, in the ASGI technical specification, this is part of the [Lifespan Protocol](https://asgi.readthedocs.io/en/latest/specs/lifespan.html), and it defines events called `startup` and `shutdown`.
 
-/// info
+/// note
 
 You can read more about the Starlette `lifespan` handlers in [Starlette's  Lifespan' docs](https://www.starlette.dev/lifespan/).
 
index 3da42819a6cf8668a8c2a40d16f2f74f37751f3b..abcbe8ce2eb4c7258e18b5e29c13eedc02b4c97e 100644 (file)
@@ -22,7 +22,7 @@ With **FastAPI**, using OpenAPI, you can define the names of these webhooks, the
 
 This can make it a lot easier for your users to **implement their APIs** to receive your **webhook** requests, they might even be able to autogenerate some of their own API code.
 
-/// info
+/// note
 
 Webhooks are available in OpenAPI 3.1.0 and above, supported by FastAPI `0.99.0` and above.
 
@@ -36,7 +36,7 @@ When you create a **FastAPI** application, there is a `webhooks` attribute that
 
 The webhooks that you define will end up in the **OpenAPI** schema and the automatic **docs UI**.
 
-/// info
+/// note
 
 The `app.webhooks` object is actually just an `APIRouter`, the same type you would use when structuring your app with multiple files.
 
index c9d18649fa35f9509e714284fbd5ae4d0bf78236..9dd50a62da7624f0bcc1e19e38696cefb56735aa 100644 (file)
@@ -18,7 +18,7 @@ You will normally have much better performance using a [Response Model](../tutor
 
 You can return a `Response` or any sub-class of it.
 
-/// info
+/// note
 
 `JSONResponse` itself is a sub-class of `Response`.
 
index 459646bbd962c9202648877c0008f68ecc60d541..92b604757b35b8f83b42e86f0c06bb90888c7dd9 100644 (file)
@@ -46,7 +46,7 @@ They are normally used to declare specific security permissions, for example:
 * `instagram_basic` is used by Facebook / Instagram.
 * `https://www.googleapis.com/auth/drive` is used by Google.
 
-/// info
+/// note
 
 In OAuth2 a "scope" is just a string that declares a specific permission required.
 
@@ -126,7 +126,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
 
 {* ../../docs_src/security/tutorial005_an_py310.py hl[5,141,172] *}
 
-/// info | Technical Details
+/// note | Technical Details
 
 `Security` is actually a subclass of `Depends`, and it has just one extra parameter that we'll see later.
 
index 4af12fa31688815a9a7d4f16da4e488c3bff20ef..3e7c89a9343c2a19d2655e8b36257c0571382443 100644 (file)
@@ -4,7 +4,7 @@ If you want to stream data that can be structured as JSON, you should [Stream JS
 
 But if you want to **stream pure binary data** or strings, here's how you can do it.
 
-/// info
+/// note
 
 Added in FastAPI 0.134.0.
 
@@ -90,7 +90,7 @@ For example, they don't have an `await file.read()`, or `async for chunk in file
 
 And in many cases, reading them would be a blocking operation (that could block the event loop), because they are read from disk or from the network.
 
-/// info
+/// note
 
 The example above is actually an exception, because the `io.BytesIO` object is already in memory, so reading it won't block anything.
 
index 54c099410c1431c47f02fb22a7d657d3506ead26..a0d9a142384eb5dd0d027f58bf3b4172d439b51b 100644 (file)
@@ -81,7 +81,7 @@ If you need to support clients that don't send a `Content-Type` header, you can
 
 With this setting, requests without a `Content-Type` header will have their body parsed as JSON, which is the same behavior as older versions of FastAPI.
 
-/// info
+/// note
 
 This behavior and configuration was added in FastAPI 0.132.0.
 
index 50c5e89a43fd3b5e27bb8507c236503d8148e355..6f4603e6ac3c96eb8a28a327dfee3b71b2458464 100644 (file)
@@ -111,7 +111,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
 
 {* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
 
-/// info
+/// note
 
 As this is a WebSocket it doesn't really make sense to raise an `HTTPException`, instead we raise a `WebSocketException`.
 
index 44807b7238ae7318e70608aa60e152e1c2c4faef..39a492eb6e723528cce508a5c6c110fa35e59d37 100644 (file)
@@ -6,7 +6,7 @@ For that, you can use the `WSGIMiddleware` and use it to wrap your WSGI applicat
 
 ## Using `WSGIMiddleware` { #using-wsgimiddleware }
 
-/// info
+/// note
 
 This requires installing `a2wsgi` for example with `pip install a2wsgi`.
 
index bfaa7aa132dde9e9739abcfd4436f22135dd28c1..0e7dc85716ee067c1ca6442586337c7158e70d01 100644 (file)
@@ -36,7 +36,7 @@ Django REST Framework was created by Tom Christie. The same creator of Starlette
 
 ///
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Have an automatic API documentation web user interface.
 
@@ -56,7 +56,7 @@ This decoupling of parts, and being a "microframework" that could be extended to
 
 Given the simplicity of Flask, it seemed like a good match for building APIs. The next thing to find was a "Django REST Framework" for Flask.
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Be a micro-framework. Making it easy to mix and match the tools and parts needed.
 
@@ -98,7 +98,7 @@ def read_url():
 
 See the similarities in `requests.get(...)` and `@app.get(...)`.
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 * Have a simple and intuitive API.
 * Use HTTP method names (operations) directly, in a straightforward and intuitive way.
@@ -118,7 +118,7 @@ At some point, Swagger was given to the Linux Foundation, to be renamed OpenAPI.
 
 That's why when talking about version 2.0 it's common to say "Swagger", and for version 3+ "OpenAPI".
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Adopt and use an open standard for API specifications, instead of a custom schema.
 
@@ -147,7 +147,7 @@ These features are what Marshmallow was built to provide. It is a great library,
 
 But it was created before there existed Python type hints. So, to define every <dfn title="the definition of how data should be formed">schema</dfn> you need to use specific utils and classes provided by Marshmallow.
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Use code to define "schemas" that provide data types and validation, automatically.
 
@@ -163,13 +163,13 @@ It uses Marshmallow underneath to do the data validation. And it was created by
 
 It's a great tool and I have used it a lot too, before having **FastAPI**.
 
-/// info
+/// note
 
 Webargs was created by the same Marshmallow developers.
 
 ///
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Have automatic validation of incoming request data.
 
@@ -193,13 +193,13 @@ But then, we have again the problem of having a micro-syntax, inside of a Python
 
 The editor can't help much with that. And if we modify parameters or Marshmallow schemas and forget to also modify that YAML docstring, the generated schema would be obsolete.
 
-/// info
+/// note
 
 APISpec was created by the same Marshmallow developers.
 
 ///
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Support the open standard for APIs, OpenAPI.
 
@@ -225,13 +225,13 @@ Using it led to the creation of several Flask full-stack generators. These are t
 
 And these same full-stack generators were the base of the [**FastAPI** Project Generators](project-generation.md).
 
-/// info
+/// note
 
 Flask-apispec was created by the same Marshmallow developers.
 
 ///
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Generate the OpenAPI schema automatically, from the same code that defines serialization and validation.
 
@@ -251,7 +251,7 @@ But as TypeScript data is not preserved after compilation to JavaScript, it cann
 
 It can't handle nested models very well. So, if the JSON body in the request is a JSON object that has inner fields that in turn are nested JSON objects, it cannot be properly documented and validated.
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Use Python types to have great editor support.
 
@@ -271,7 +271,7 @@ It clearly inspired Uvicorn and Starlette, that are currently faster than Sanic
 
 ///
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Find a way to have a crazy performance.
 
@@ -287,7 +287,7 @@ It is designed to have functions that receive two parameters, one "request" and
 
 So, data validation, serialization, and documentation, have to be done in code, not automatically. Or they have to be implemented as a framework on top of Falcon, like Hug. This same distinction happens in other frameworks that are inspired by Falcon's design, of having one request object and one response object as parameters.
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Find ways to get great performance.
 
@@ -313,7 +313,7 @@ The dependency injection system requires pre-registration of the dependencies an
 
 Routes are declared in a single place, using functions declared in other places (instead of using decorators that can be placed right on top of the function that handles the endpoint). This is closer to how Django does it than to how Flask (and Starlette) does it. It separates in the code things that are relatively tightly coupled.
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Define extra validations for data types using the "default" value of model attributes. This improves editor support, and it was not available in Pydantic before.
 
@@ -335,13 +335,13 @@ It has an interesting, uncommon feature: using the same framework, it's possible
 
 As it is based on the previous standard for synchronous Python web frameworks (WSGI), it can't handle Websockets and other things, although it still has high performance too.
 
-/// info
+/// note
 
 Hug was created by Timothy Crosley, the same creator of [`isort`](https://github.com/timothycrosley/isort), a great tool to automatically sort imports in Python files.
 
 ///
 
-/// check | Ideas inspiring **FastAPI**
+/// tip | Ideas inspiring **FastAPI**
 
 Hug inspired parts of APIStar, and was one of the tools I found most promising, alongside APIStar.
 
@@ -375,7 +375,7 @@ It was no longer an API web framework, as the creator needed to focus on Starlet
 
 Now APIStar is a set of tools to validate OpenAPI specifications, not a web framework.
 
-/// info
+/// note
 
 APIStar was created by Tom Christie. The same guy that created:
 
@@ -385,7 +385,7 @@ APIStar was created by Tom Christie. The same guy that created:
 
 ///
 
-/// check | Inspired **FastAPI** to
+/// tip | Inspired **FastAPI** to
 
 Exist.
 
@@ -409,7 +409,7 @@ That makes it extremely intuitive.
 
 It is comparable to Marshmallow. Although it's faster than Marshmallow in benchmarks. And as it is based on the same Python type hints, the editor support is great.
 
-/// check | **FastAPI** uses it to
+/// tip | **FastAPI** uses it to
 
 Handle all the data validation, data serialization and automatic model documentation (based on JSON Schema).
 
@@ -452,7 +452,7 @@ Nevertheless, it is already being used as a "standard" by several tools. This gr
 
 ///
 
-/// check | **FastAPI** uses it to
+/// tip | **FastAPI** uses it to
 
 Handle all the core web parts. Adding features on top.
 
@@ -470,7 +470,7 @@ It is not a web framework, but a server. For example, it doesn't provide tools f
 
 It is the recommended server for Starlette and **FastAPI**.
 
-/// check | **FastAPI** recommends it as
+/// tip | **FastAPI** recommends it as
 
 The main web server to run **FastAPI** applications.
 
index 8d445ace1b5ebc0a5b5f29af5a8cba846ab3ec3f..1ad99603421be32051dc46248f27f6da025c5b09 100644 (file)
@@ -139,7 +139,7 @@ You and your crush eat the burgers and have a nice time. ✨
 
 <img src="/img/async/concurrent-burgers/concurrent-burgers-07.png" class="illustration">
 
-/// info
+/// note
 
 Beautiful illustrations by [Ketrina Thompson](https://www.instagram.com/ketrinadrawsalot). 🎨
 
@@ -205,7 +205,7 @@ You just eat them, and you are done. ⏹
 
 There was not much talk or flirting as most of the time was spent waiting 🕙 in front of the counter. 😞
 
-/// info
+/// note
 
 Beautiful illustrations by [Ketrina Thompson](https://www.instagram.com/ketrinadrawsalot). 🎨
 
index ce7d0f1c7b20e47fed3de4b2869476c1bff34c77..b021ef1b6a9846a890ff2d0ed90e3db78fad5699 100644 (file)
@@ -132,7 +132,7 @@ Successfully installed fastapi pydantic
 
 </div>
 
-/// info
+/// note
 
 There are other formats and tools to define and install package dependencies.
 
@@ -556,7 +556,7 @@ If you are using containers (e.g. Docker, Kubernetes), then there are two main a
 
 If you have **multiple containers**, probably each one running a **single process** (for example, in a **Kubernetes** cluster), then you would probably want to have a **separate container** doing the work of the **previous steps** in a single container, running a single process, **before** running the replicated worker containers.
 
-/// info
+/// note
 
 If you are using Kubernetes, this would probably be an [Init Container](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/).
 
index 4f292224cff5b6e3825ce106f2c77b855db492cb..fb0741acb2127f869e004669dd6b9d54caf8c974 100644 (file)
@@ -17,7 +17,7 @@ As you saw in the previous chapter about [Deployment Concepts](concepts.md), the
 
 Here I'll show you how to use **Uvicorn** with **worker processes** using the `fastapi` command or the `uvicorn` command directly.
 
-/// info
+/// note
 
 If you are using containers, for example with Docker or Kubernetes, I'll tell you more about that in the next chapter: [FastAPI in Containers - Docker](docker.md).
 
index 80485fd30f718b0536f3243a6c75de25b06dd18f..e92c881f4237216d5fa8e0435855bce241f0d4d3 100644 (file)
@@ -6,7 +6,7 @@ There are many posts, articles, tools, and projects, related to **FastAPI**.
 
 You could easily use a search engine or video platform to find many resources related to FastAPI.
 
-/// info
+/// note
 
 Before, this page used to list links to external articles.
 
index eee11cd1ea9c909801fc7ce5dc7b0181bf683ce3..a1a271d28833e204d6fc0d0f201ce41f2a3a31b4 100644 (file)
@@ -63,7 +63,7 @@ second_user_data = {
 my_second_user: User = User(**second_user_data)
 ```
 
-/// info
+/// note
 
 `**second_user_data` means:
 
index ab68961caefb7034088232d4efcd83bf430540c6..92ff0f2e02f7a3932972dad6f8cb30fbd00043b8 100644 (file)
@@ -170,7 +170,7 @@ And if there's any other style or consistency need, I'll ask directly for that,
 
 * Then **comment** saying that you did that, that's how I will know you really checked it.
 
-/// info
+/// note
 
 Unfortunately, I can't simply trust PRs that just have several approvals.
 
index c110a444f12ca325502a0938d99a131d585a2f4a..65f58443832e72e2883d29ab83aeaa0c109ab34d 100644 (file)
@@ -27,7 +27,7 @@ And that function `get_openapi()` receives as parameters:
 * `description`: The description of your API, this can include markdown and will be shown in the docs.
 * `routes`: A list of routes, these are each of the registered *path operations*. They are taken from `app.routes`.
 
-/// info
+/// note
 
 The parameter `summary` is available in OpenAPI 3.1.0 and above, supported by FastAPI 0.99.0 and above.
 
index d790c600bba66cea90708f140d5fe9885216a35a..4eb684dc90a64ad8f7a8e724698e1bb6a7177ef3 100644 (file)
@@ -85,7 +85,7 @@ Probably the main use case for this is if you already have some autogenerated cl
 
 In that case, you can disable this feature in **FastAPI**, with the parameter `separate_input_output_schemas=False`.
 
-/// info
+/// note
 
 Support for `separate_input_output_schemas` was added in FastAPI `0.102.0`. 🤓
 
index 0cddcd390218190eacb5abb0371bac7522aeaf98..976129117edd57d0d0eb9715ee168398ca8b32c1 100644 (file)
@@ -172,7 +172,7 @@ As the list is a type that contains some internal types, you put them in square
 
 {* ../../docs_src/python_types/tutorial006_py310.py hl[1] *}
 
-/// info
+/// note
 
 Those internal types in the square brackets are called "type parameters".
 
@@ -283,7 +283,7 @@ An example from the official Pydantic docs:
 
 {* ../../docs_src/python_types/tutorial011_py310.py *}
 
-/// info
+/// note
 
 To learn more about [Pydantic, check its docs](https://docs.pydantic.dev/).
 
@@ -341,7 +341,7 @@ This might all sound abstract. Don't worry. You'll see all this in action in the
 
 The important thing is that by using standard Python types, in a single place (instead of adding more classes, decorators, etc), **FastAPI** will do a lot of the work for you.
 
-/// info
+/// note
 
 If you already went through all the tutorial and came back to see more about types, a good resource is [the "cheat sheet" from `mypy`](https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html).
 
index 675ec1b437687f248c6501f00e6616fd8b1fdb35..8950d59b4223993a3c31c7923ab80e33715aa374 100644 (file)
@@ -4,7 +4,7 @@ If you are building an application or a web API, it's rarely the case that you c
 
 **FastAPI** provides a convenience tool to structure your application while keeping all the flexibility.
 
-/// info
+/// note
 
 If you come from Flask, this would be the equivalent of Flask's Blueprints.
 
@@ -194,7 +194,7 @@ Having `dependencies` in the `APIRouter` can be used, for example, to require au
 
 ///
 
-/// check
+/// tip
 
 The `prefix`, `tags`, `responses`, and `dependencies` parameters are (as in many other cases) just a feature from **FastAPI** to help you avoid code duplication.
 
@@ -339,7 +339,7 @@ We could also import them like:
 from app.routers import items, users
 ```
 
-/// info
+/// note
 
 The first version is a "relative import":
 
@@ -382,7 +382,7 @@ Now, let's include the `router`s from the submodules `users` and `items`:
 
 {* ../../docs_src/bigger_applications/app_an_py310/main.py hl[10:11] title["app/main.py"] *}
 
-/// info
+/// note
 
 `users.router` contains the `APIRouter` inside of the file `app/routers/users.py`.
 
@@ -402,7 +402,7 @@ So, behind the scenes, it will actually work as if everything was the same singl
 
 ///
 
-/// check
+/// tip
 
 You don't have to worry about performance when including routers.
 
@@ -451,7 +451,7 @@ Here we do it... just to show that we can 🤷:
 
 and it will work correctly, together with all the other *path operations* added with `app.include_router()`.
 
-/// info | Very Technical Details
+/// note | Very Technical Details
 
 **Note**: this is a very technical detail that you probably can **just skip**.
 
index d904fb8397a5f92cf36ba974cab9fbd31373aee6..cdef50ec38940fffe829a2465a11f1d7b70eb29a 100644 (file)
@@ -111,7 +111,7 @@ For example:
 {* ../../docs_src/body_multiple_params/tutorial004_an_py310.py hl[28] *}
 
 
-/// info
+/// note
 
 `Body` also has all the same extra validation and metadata parameters as `Query`, `Path` and others you will see later.
 
index 17c560f40e5fde48b7a22d632bb2324b993eb8ab..5479ab2a45930f1a79287f974654b3f7159aa133 100644 (file)
@@ -136,7 +136,7 @@ This will expect (convert, validate, document, etc.) a JSON body like:
 }
 ```
 
-/// info
+/// note
 
 Notice how the `images` key now has a list of image objects.
 
@@ -148,7 +148,7 @@ You can define arbitrarily deeply nested models:
 
 {* ../../docs_src/body_nested_models/tutorial007_py310.py hl[7,12,18,21,25] *}
 
-/// info
+/// note
 
 Notice how `Offer` has a list of `Item`s, which in turn have an optional list of `Image`s
 
index ca72548a4d05ca317135399f7745e90f06df0686..dda9798d8b74c9079aa61863bcee26bd51747bd1 100644 (file)
@@ -8,7 +8,7 @@ Your API almost always has to send a **response** body. But clients don't necess
 
 To declare a **request** body, you use [Pydantic](https://docs.pydantic.dev/) models with all their power and benefits.
 
-/// info
+/// note
 
 To send data, you should use one of: `POST` (the more common), `PUT`, `DELETE` or `PATCH`.
 
index 609838f766d118edbaa836c0f2657617e2ab2f32..27fb1164a367e9551c3efc74bd9d784551520a81 100644 (file)
@@ -32,7 +32,7 @@ You can see the defined cookies in the docs UI at `/docs`:
 <img src="/img/tutorial/cookie-param-models/image01.png">
 </div>
 
-/// info
+/// note
 
 Have in mind that, as **browsers handle cookies** in special ways and behind the scenes, they **don't** easily allow **JavaScript** to touch them.
 
index f44fd41bde0283655b0ed094b152adcdf9252a2a..b57cea8a7ecda0f437492c1ce106055d3a308b56 100644 (file)
@@ -24,13 +24,13 @@ But remember that when you import `Query`, `Path`, `Cookie` and others from `fas
 
 ///
 
-/// info
+/// note
 
 To declare cookies, you need to use `Cookie`, because otherwise the parameters would be interpreted as query parameters.
 
 ///
 
-/// info
+/// note
 
 Have in mind that, as **browsers handle cookies** in special ways and behind the scenes, they **don't** easily allow **JavaScript** to touch them.
 
index d157cb7bf0eb8b1ab3e703c74aef6a02a7ab6310..8db47b9346c855a4845a99d13fb9276d83992f4a 100644 (file)
@@ -72,7 +72,7 @@ So, the line:
 
 will not be executed.
 
-/// info
+/// note
 
 For more information, check [the official Python docs](https://docs.python.org/3/library/__main__.html).
 
index e663c40823a1bfe638fc79a824839e1eb8c2eebd..82d4526b15b9ba7486c6dce41d25635a783a7c48 100644 (file)
@@ -28,7 +28,7 @@ It might also help avoid confusion for new developers that see an unused paramet
 
 ///
 
-/// info
+/// note
 
 In this example we use invented custom headers `X-Key` and `X-Token`.
 
index 7b80a74e4466a9ba8978a95c459cdd6137884552..658dee7c200b364e4bdab8febbae6d933bbc64d6 100644 (file)
@@ -170,7 +170,7 @@ participant tasks as Background tasks
     end
 ```
 
-/// info
+/// note
 
 Only **one response** will be sent to the client. It might be one of the error responses or it will be the response from the *path operation*.
 
index 396c23acbbd9f8cca22805e038c88e06a93590c1..0bf651adb645ee5ec0b01f3553e35e85a20463ec 100644 (file)
@@ -51,7 +51,7 @@ In this case, this dependency expects:
 
 And then it just returns a `dict` containing those values.
 
-/// info
+/// note
 
 FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.
 
@@ -106,7 +106,7 @@ common_parameters --> read_users
 
 This way you write shared code once and **FastAPI** takes care of calling it for your *path operations*.
 
-/// check
+/// tip
 
 Notice that you don't have to create a special class and pass it somewhere to **FastAPI** to "register" it or anything similar.
 
index 99588dd3c536a794560a0844299e15293735e48a..34b0248e9db570870b91f9a7806d55997fa686df 100644 (file)
@@ -35,7 +35,7 @@ Then we can use the dependency with:
 
 {* ../../docs_src/dependencies/tutorial005_an_py310.py hl[23] *}
 
-/// info
+/// note
 
 Notice that we are only declaring one dependency in the *path operation function*, the `query_or_cookie_extractor`.
 
index 3355079900b38bed001be2c7e816469c3d16a961..96aaa7463b106af548631612937afdbe13f6c53e 100644 (file)
@@ -270,7 +270,7 @@ https://example.com/items/foo
 /items/foo
 ```
 
-/// info
+/// note
 
 A "path" is also commonly called an "endpoint" or a "route".
 
@@ -322,7 +322,7 @@ The `@app.get("/")` tells **FastAPI** that the function right below is in charge
 * the path `/`
 * using a <dfn title="an HTTP GET method"><code>get</code> operation</dfn>
 
-/// info | `@decorator` Info
+/// note | `@decorator` Info
 
 That `@something` syntax in Python is called a "decorator".
 
index 3765956a05172278a3fe885bcc07a8d3569c9c16..9f72545d383ae0488ac0a18a48cc2d5d866ded7e 100644 (file)
@@ -24,7 +24,7 @@ But remember that when you import `Query`, `Path`, `Header`, and others from `fa
 
 ///
 
-/// info
+/// note
 
 To declare headers, you need to use `Header`, because otherwise the parameters would be interpreted as query parameters.
 
index 2abf0a342113c2b83d8b31b6b916e033e79b55c5..9cab5ca71bd6b94c9a253d056830f6b2aaebbdab 100644 (file)
@@ -74,7 +74,7 @@ Use the `tags` parameter with your *path operations* (and `APIRouter`s) to assig
 
 {* ../../docs_src/metadata/tutorial004_py310.py hl[21,26] *}
 
-/// info
+/// note
 
 Read more about tags in [Path Operation Configuration](path-operation-configuration.md#tags).
 
index e350f7683fb9aa72817296c5767d8fa276ec8a5f..8dfc6e2ffc490edbf00dc934acd44e51159b8ab5 100644 (file)
@@ -72,13 +72,13 @@ You can specify the response description with the parameter `response_descriptio
 
 {* ../../docs_src/path_operation_configuration/tutorial005_py310.py hl[18] *}
 
-/// info
+/// note
 
 Notice that `response_description` refers specifically to the response, the `description` refers to the *path operation* in general.
 
 ///
 
-/// check
+/// tip
 
 OpenAPI specifies that each *path operation* requires a response description.
 
index 2ba40e92fe16da3d3361214990a5b10f93495563..8039b8048187a51c74891bba58b9b2f2e83d972a 100644 (file)
@@ -8,7 +8,7 @@ First, import `Path` from `fastapi`, and import `Annotated`:
 
 {* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[1,3] *}
 
-/// info
+/// note
 
 FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.
 
@@ -131,7 +131,7 @@ And you can also declare numeric validations:
 * `lt`: `l`ess `t`han
 * `le`: `l`ess than or `e`qual
 
-/// info
+/// note
 
 `Query`, `Path`, and other classes you will see later are subclasses of a common `Param` class.
 
index 6614dfdcb718a944b0d66ea1c089153e58dc2287..c8fe68f5e4abb5681adb59f8c2ff6d34adc28ff9 100644 (file)
@@ -20,7 +20,7 @@ You can declare the type of a path parameter in the function, using standard Pyt
 
 In this case, `item_id` is declared to be an `int`.
 
-/// check
+/// tip
 
 This will give you editor support inside of your function, with error checks, completion, etc.
 
@@ -34,7 +34,7 @@ If you run this example and open your browser at [http://127.0.0.1:8000/items/3]
 {"item_id":3}
 ```
 
-/// check
+/// tip
 
 Notice that the value your function received (and returned) is `3`, as a Python `int`, not a string `"3"`.
 
@@ -66,7 +66,7 @@ because the path parameter `item_id` had a value of `"foo"`, which is not an `in
 
 The same error would appear if you provided a `float` instead of an `int`, as in: [http://127.0.0.1:8000/items/4.2](http://127.0.0.1:8000/items/4.2)
 
-/// check
+/// tip
 
 So, with the same Python type declaration, **FastAPI** gives you data validation.
 
@@ -82,7 +82,7 @@ And when you open your browser at [http://127.0.0.1:8000/docs](http://127.0.0.1:
 
 <img src="/img/tutorial/path-params/image01.png">
 
-/// check
+/// tip
 
 Again, just with that same Python type declaration, **FastAPI** gives you automatic, interactive documentation (integrating Swagger UI).
 
index 4765b36cbe1235dfa30ada02611b8a09569362d4..0714d8beb19ce97e983bfa6963b6c7e76b06be81 100644 (file)
@@ -29,7 +29,7 @@ To achieve that, first import:
 
 {* ../../docs_src/query_params_str_validations/tutorial002_an_py310.py hl[1,3] *}
 
-/// info
+/// note
 
 FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.
 
@@ -382,7 +382,7 @@ For example, this custom validator checks that the item ID starts with `isbn-` f
 
 {* ../../docs_src/query_params_str_validations/tutorial015_an_py310.py hl[5,16:19,24] *}
 
-/// info
+/// note
 
 This is available with Pydantic version 2 or above. 😎
 
index efe2c6d7a0fbf24d6a52eaec2a67764eee92b899..563d39f7d4752322ef8c467b03c43227e680d64c 100644 (file)
@@ -65,7 +65,7 @@ The same way, you can declare optional query parameters, by setting their defaul
 
 In this case, the function parameter `q` will be optional, and will be `None` by default.
 
-/// check
+/// tip
 
 Also notice that **FastAPI** is smart enough to notice that the path parameter `item_id` is a path parameter and `q` is not, so, it's a query parameter.
 
index ae3d6a119d63fb1c2344840a9d496fdb65c537b8..fe4290449bc5e0b752d8536e71ffed4873ee0b77 100644 (file)
@@ -2,7 +2,7 @@
 
 You can define files to be uploaded by the client using `File`.
 
-/// info
+/// note
 
 To receive uploaded files, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
 
@@ -28,7 +28,7 @@ Create file parameters the same way you would for `Body` or `Form`:
 
 {* ../../docs_src/request_files/tutorial001_an_py310.py hl[9] *}
 
-/// info
+/// note
 
 `File` is a class that inherits directly from `Form`.
 
index 2e0f463294555b08b7b04881feaf2af0916720ed..71766bd4ef5bfb681cf5a884f6713c98db389db9 100644 (file)
@@ -2,7 +2,7 @@
 
 You can use **Pydantic models** to declare **form fields** in FastAPI.
 
-/// info
+/// note
 
 To use forms, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
 
index 1443004120babb9c1b3c0fc6c6ae1e8e8e8e0bc9..f6a839491c6b44d822a68db4e8189874a28d59e9 100644 (file)
@@ -2,7 +2,7 @@
 
 You can define files and form fields at the same time using `File` and `Form`.
 
-/// info
+/// note
 
 To receive uploaded files and/or form data, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
 
index 8c4b32d85098c90feb48e9f571e04952d90e0a09..64e90a244224d55a0c53df871f52270bd8c0bdfd 100644 (file)
@@ -2,7 +2,7 @@
 
 When you need to receive form fields instead of JSON, you can use `Form`.
 
-/// info
+/// note
 
 To use forms, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
 
@@ -32,7 +32,7 @@ The <dfn title="specification">spec</dfn> requires the fields to be exactly name
 
 With `Form` you can declare the same configurations as with `Body` (and `Query`, `Path`, `Cookie`), including validation, examples, an alias (e.g. `user-name` instead of `username`), etc.
 
-/// info
+/// note
 
 `Form` is a class that inherits directly from `Body`.
 
index d628167ddb153d8a122ce18284309f2edcc2dd3e..ae93eece673b6c67f76d0d07e61785f2528193bf 100644 (file)
@@ -72,7 +72,7 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
 
 {* ../../docs_src/response_model/tutorial002_py310.py hl[7,9] *}
 
-/// info
+/// note
 
 To use `EmailStr`, first install [`email-validator`](https://github.com/JoshData/python-email-validator).
 
@@ -251,7 +251,7 @@ So, if you send a request to that *path operation* for the item with ID `foo`, t
 }
 ```
 
-/// info
+/// note
 
 You can also use:
 
index dcadaa36d816ec9097f50ccd4299923e7dd513f6..a5f82ffb6501ba1ce560b77044f7427239d303ce 100644 (file)
@@ -18,7 +18,7 @@ Notice that `status_code` is a parameter of the "decorator" method (`get`, `post
 
 The `status_code` parameter receives a number with the HTTP status code.
 
-/// info
+/// note
 
 `status_code` can alternatively also receive an `IntEnum`, such as Python's [`http.HTTPStatus`](https://docs.python.org/3/library/http.html#http.HTTPStatus).
 
index 2b5fe11c0bdbdc1e0916355d0255552c8db01652..67c7ac37c2654cd4cb75a4854df47e45ed166895 100644 (file)
@@ -24,7 +24,7 @@ For example you could use it to add metadata for a frontend user interface, etc.
 
 ///
 
-/// info
+/// note
 
 OpenAPI 3.1.0 (used since FastAPI 0.99.0) added support for `examples`, which is part of the **JSON Schema** standard.
 
@@ -155,7 +155,7 @@ OpenAPI also added `example` and `examples` fields to other parts of the specifi
     * `File()`
     * `Form()`
 
-/// info
+/// note
 
 This old OpenAPI-specific `examples` parameter is now `openapi_examples` since FastAPI `0.103.0`.
 
@@ -171,7 +171,7 @@ And now this new `examples` field takes precedence over the old single (and cust
 
 This new `examples` field in JSON Schema is **just a `list`** of examples, not a dict with extra metadata as in the other places in OpenAPI (described above).
 
-/// info
+/// note
 
 Even after OpenAPI 3.1.0 was released with this new simpler integration with JSON Schema, for a while, Swagger UI, the tool that provides the automatic docs, didn't support OpenAPI 3.1.0 (it does since version 5.0.0 🎉).
 
index cf19f7dbdc9e4fb2312f44d5ae32865fd960bca6..095b8b9017fe01c2e3eda010ba4c668f50921d29 100644 (file)
@@ -24,7 +24,7 @@ Copy the example in a file `main.py`:
 
 ## Run it { #run-it }
 
-/// info
+/// note
 
 The [`python-multipart`](https://github.com/Kludex/python-multipart) package is automatically installed with **FastAPI** when you run the `pip install "fastapi[standard]"` command.
 
@@ -60,7 +60,7 @@ You will see something like this:
 
 <img src="/img/tutorial/security/image01.png">
 
-/// check | Authorize button!
+/// tip | Authorize button!
 
 You already have a shiny new "Authorize" button.
 
@@ -118,7 +118,7 @@ So, let's review it from that simplified point of view:
 
 In this example we are going to use **OAuth2**, with the **Password** flow, using a **Bearer** token. We do that using the `OAuth2PasswordBearer` class.
 
-/// info
+/// note
 
 A "bearer" token is not the only option.
 
@@ -148,7 +148,7 @@ This parameter doesn't create that endpoint / *path operation*, but declares tha
 
 We will soon also create the actual path operation.
 
-/// info
+/// note
 
 If you are a very strict "Pythonista" you might dislike the style of the parameter name `tokenUrl` instead of `token_url`.
 
@@ -176,7 +176,7 @@ This dependency will provide a `str` that is assigned to the parameter `token` o
 
 **FastAPI** will know that it can use this dependency to define a "security scheme" in the OpenAPI schema (and the automatic API docs).
 
-/// info | Technical Details
+/// note | Technical Details
 
 **FastAPI** will know that it can use the class `OAuth2PasswordBearer` (declared in a dependency) to define the security scheme in OpenAPI because it inherits from `fastapi.security.oauth2.OAuth2`, which in turn inherits from `fastapi.security.base.SecurityBase`.
 
index 2eb80341f97591f109c0966503a0bcae96143309..f8a5fdf821398ad81c517937e4d5a03a2777f6a3 100644 (file)
@@ -52,7 +52,7 @@ Here **FastAPI** won't get confused because you are using `Depends`.
 
 ///
 
-/// check
+/// tip
 
 The way this dependency system is designed allows us to have different dependencies (different "dependables") that all return a `User` model.
 
index fabdd06a6bb7a160a6b5c80b4ebb98fda217683e..983da9a8590824589f2ca6792cbc6a889a3dc30c 100644 (file)
@@ -42,7 +42,7 @@ $ pip install pyjwt
 
 </div>
 
-/// info
+/// note
 
 If you are planning to use digital signature algorithms like RSA or ECDSA, you should install the cryptography library dependency `pyjwt[crypto]`.
 
@@ -213,7 +213,7 @@ Using the credentials:
 Username: `johndoe`
 Password: `secret`
 
-/// check
+/// tip
 
 Notice that nowhere in the code is the plaintext password "`secret`", we only have the hashed version.
 
index a98112d7653339a9683728eb9eb3f20b59df6b3f..afe3ba128f3271d4126f7cced152ef9ccecc00be 100644 (file)
@@ -32,7 +32,7 @@ They are normally used to declare specific security permissions, for example:
 * `instagram_basic` is used by Facebook / Instagram.
 * `https://www.googleapis.com/auth/drive` is used by Google.
 
-/// info
+/// note
 
 In OAuth2 a "scope" is just a string that declares a specific permission required.
 
@@ -72,7 +72,7 @@ If you need to enforce it, use `OAuth2PasswordRequestFormStrict` instead of `OAu
 * An optional `client_id` (we don't need it for our example).
 * An optional `client_secret` (we don't need it for our example).
 
-/// info
+/// note
 
 The `OAuth2PasswordRequestForm` is not a special class for **FastAPI** as is `OAuth2PasswordBearer`.
 
@@ -144,7 +144,7 @@ UserInDB(
 )
 ```
 
-/// info
+/// note
 
 For a more complete explanation of `**user_dict` check back in [the documentation for **Extra Models**](../extra-models.md#about-user-in-dict).
 
@@ -196,7 +196,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
 
 {* ../../docs_src/security/tutorial003_an_py310.py hl[58:66,69:74,94] *}
 
-/// info
+/// note
 
 The additional header `WWW-Authenticate` with value `Bearer` we are returning here is also part of the spec.
 
index d264f8536f097bd0865570bec27987826657544e..bbac05bd69e18c808797c144b011690f214c99d9 100644 (file)
@@ -4,7 +4,7 @@ You can stream data to the client using **Server-Sent Events** (SSE).
 
 This is similar to [Stream JSON Lines](stream-json-lines.md), but uses the `text/event-stream` format, which is supported natively by browsers with the [`EventSource` API](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).
 
-/// info
+/// note
 
 Added in FastAPI 0.135.0.
 
index 3006636362994d675c72834df65d5fc2400fb252..ea1b781a734fa0e1ecd4f893de4469004f021a47 100644 (file)
@@ -2,7 +2,7 @@
 
 You could have a sequence of data that you would like to send in a "**stream**", you could do it with **JSON Lines**.
 
-/// info
+/// note
 
 Added in FastAPI 0.134.0.
 
@@ -48,7 +48,7 @@ A response would have a content type of `application/jsonl` (instead of `applica
 
 It's very similar to a JSON array (equivalent of a Python list), but instead of being wrapped in `[]` and having `,` between the items, it has **one JSON object per line**, they are separated by a new line character.
 
-/// info
+/// note
 
 The important point is that your app will be able to produce each line in turn, while the client consumes the previous lines.
 
index 5b8fbba07c49feac200e581968c786ff3bd3ccfe..72f849f4bfd4c3b51d82cca75e0ca945ff35e66d 100644 (file)
@@ -8,7 +8,7 @@ With it, you can use [pytest](https://docs.pytest.org/) directly with **FastAPI*
 
 ## Using `TestClient` { #using-testclient }
 
-/// info
+/// note
 
 To use `TestClient`, first install [`httpx`](https://www.python-httpx.org).
 
@@ -144,7 +144,7 @@ E.g.:
 
 For more information about how to pass data to the backend (using `httpx` or the `TestClient`) check the [HTTPX documentation](https://www.python-httpx.org).
 
-/// info
+/// note
 
 Note that the `TestClient` receives data that can be converted to JSON, not Pydantic models.
 
index 1035013a0b885e8f28052f184a6612c4468eb35a..119a6926a3644ecf77de81996dffc94e8274212c 100644 (file)
@@ -2,7 +2,7 @@
 
 When you work in Python projects you probably should use a **virtual environment** (or a similar mechanism) to isolate the packages you install for each project.
 
-/// info
+/// note
 
 If you already know about virtual environments, how to create them and use them, you might want to skip this section. 🤓
 
@@ -18,7 +18,7 @@ A **virtual environment** is a directory with some files in it.
 
 ///
 
-/// info
+/// note
 
 This page will teach you how to use **virtual environments** and how they work.
 
index 4614194981b698b233fed0bf315a078026dfb1a5..bb67bca917e41a50dc949bd5301a29ccf96319ab 100644 (file)
@@ -290,7 +290,10 @@ markdown_extensions:
       format: !!python/name:pymdownx.superfences.fence_code_format ''
   pymdownx.tilde: null
   pymdownx.blocks.admonition:
+    # TODO: remove types section (with custom types) once translations are migrated to
+    # not use custom types too
     types:
+    # Default types
     - note
     - attention
     - caution
@@ -299,6 +302,7 @@ markdown_extensions:
     - tip
     - hint
     - warning
+    # Custom types
     - info
     - check
   pymdownx.blocks.details: null