- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 45 for APIRoute (0.05 seconds)
-
docs/en/docs/how-to/custom-request-and-route.md
# Custom Request and APIRoute class { #custom-request-and-apiroute-class } In some cases, you may want to override the logic used by the `Request` and `APIRoute` classes. In particular, this may be a good alternative to logic in a middleware. For example, if you want to read or manipulate the request body before it is processed by your application. /// danger This is an "advanced" feature.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 4.4K bytes - Click Count (0) -
docs/zh-hant/docs/how-to/custom-request-and-route.md
# 自訂 Request 與 APIRoute 類別 { #custom-request-and-apiroute-class } 在某些情況下,你可能想要覆寫 `Request` 與 `APIRoute` 類別所使用的邏輯。 特別是,這可能是替代中介軟體(middleware)中實作邏輯的一個好方法。 例如,如果你想在應用程式處理之前讀取或操作請求本文(request body)。 /// danger 這是進階功能。 如果你剛開始使用 **FastAPI**,可以先跳過本節。 /// ## 使用情境 { #use-cases } 可能的使用情境包括: * 將非 JSON 的請求本文轉換為 JSON(例如 [`msgpack`](https://msgpack.org/index.html))。 * 解壓縮以 gzip 壓縮的請求本文。 * 自動記錄所有請求本文。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 4.2K bytes - Click Count (0) -
docs/ko/docs/how-to/custom-request-and-route.md
# 커스텀 Request 및 APIRoute 클래스 { #custom-request-and-apiroute-class } 일부 경우에는 `Request`와 `APIRoute` 클래스에서 사용되는 로직을 오버라이드하고 싶을 수 있습니다. 특히, 이는 middleware에 있는 로직의 좋은 대안이 될 수 있습니다. 예를 들어, 애플리케이션에서 처리되기 전에 요청 바디를 읽거나 조작하고 싶을 때가 그렇습니다. /// danger | 위험 이 기능은 "고급" 기능입니다. **FastAPI**를 이제 막 시작했다면 이 섹션은 건너뛰는 것이 좋습니다. /// ## 사용 사례 { #use-cases } 사용 사례에는 다음이 포함됩니다:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:06:26 GMT 2026 - 5.2K bytes - Click Count (0) -
docs_src/path_operation_advanced_configuration/tutorial002_py310.py
from fastapi import FastAPI from fastapi.routing import APIRoute app = FastAPI() @app.get("/items/") async def read_items(): return [{"item_id": "Foo"}] def use_route_names_as_operation_ids(app: FastAPI) -> None: """ Simplify operation IDs so that generated API clients have simpler function names. Should be called only after all routes have been added. """ for route in app.routes:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 572 bytes - Click Count (0) -
tests/test_custom_route_class.py
import pytest from fastapi import APIRouter, FastAPI from fastapi.routing import APIRoute from fastapi.testclient import TestClient from inline_snapshot import snapshot from starlette.routing import Route app = FastAPI() class APIRouteA(APIRoute): x_type = "A" class APIRouteB(APIRoute): x_type = "B" class APIRouteC(APIRoute): x_type = "C" router_a = APIRouter(route_class=APIRouteA)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 3.3K bytes - Click Count (0) -
docs/ja/docs/how-to/custom-request-and-route.md
# カスタム Request と APIRoute クラス { #custom-request-and-apiroute-class } 場合によっては、`Request` や `APIRoute` クラスで使われるロジックを上書きしたいことがあります。 特に、ミドルウェアでのロジックの代替として有効な場合があります。 たとえば、アプリケーションで処理される前にリクエストボディを読み取ったり操作したりしたい場合です。 /// danger | 警告 これは「上級」機能です。 FastAPI を始めたばかりの場合は、このセクションは読み飛ばしてもよいでしょう。 /// ## ユースケース { #use-cases } ユースケースの例: * JSON ではないリクエストボディを JSON に変換する(例: [`msgpack`](https://msgpack.org/index.html))。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 5.4K bytes - Click Count (0) -
fastapi/utils.py
from fastapi.exceptions import FastAPIDeprecationWarning, PydanticV1NotSupportedError from pydantic.fields import FieldInfo from ._compat import v2 if TYPE_CHECKING: # pragma: nocover from .routing import APIRoute def is_body_allowed_for_status_code(status_code: int | str | None) -> bool: if status_code is None: return TrueCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 11 18:41:21 GMT 2026 - 4.2K bytes - Click Count (0) -
fastapi/routing.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 193K bytes - Click Count (0) -
docs/en/docs/advanced/generate-clients.md
FastAPI uses a **unique ID** for each *path operation*, which is used for the **operation ID** and also for the names of any needed custom models, for requests or responses. You can customize that function. It takes an `APIRoute` and outputs a string. For example, here it is using the first tag (you will probably have only one tag) and the *path operation* name (the function name).
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 9.7K bytes - Click Count (1) -
docs/ja/docs/advanced/generate-clients.md
### 一意 ID 生成関数のカスタマイズ { #custom-generate-unique-id-function } FastAPI は各 *path operation* に**一意 ID**を用いており、これは **operation ID** のほか、必要に応じてリクエストやレスポンスのカスタムモデル名にも使われます。 この関数はカスタマイズ可能です。`APIRoute` を受け取り、文字列を返します。 例えばここでは、最初のタグ(通常は 1 つ)と *path operation* 名(関数名)を使います。 そのカスタム関数を **FastAPI** の `generate_unique_id_function` パラメータに渡します: {* ../../docs_src/generate_clients/tutorial003_py310.py hl[6:7,10] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 11.1K bytes - Click Count (0)