- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 11 for generate_unique_id (0.51 sec)
-
tests/test_generate_unique_id_function.py
} def test_app_path_operation_overrides_generate_unique_id(): app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post( "/", response_model=List[Item], responses={404: {"model": List[Message]}}, generate_unique_id_function=custom_generate_unique_id3, )
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 13 15:10:26 GMT 2024 - 66.7K bytes - Viewed (0) -
docs_src/generate_clients/tutorial003_py39.py
from fastapi import FastAPI from fastapi.routing import APIRoute from pydantic import BaseModel def custom_generate_unique_id(route: APIRoute): return f"{route.tags[0]}-{route.name}" app = FastAPI(generate_unique_id_function=custom_generate_unique_id) class Item(BaseModel): name: str price: float class ResponseMessage(BaseModel): message: str class User(BaseModel): username: str
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 04 22:02:18 GMT 2022 - 914 bytes - Viewed (0) -
fastapi/routing.py
if isinstance(generate_unique_id_function, DefaultPlaceholder): current_generate_unique_id: Callable[ ["APIRoute"], str ] = generate_unique_id_function.value else: current_generate_unique_id = generate_unique_id_function self.unique_id = self.operation_id or current_generate_unique_id(self) # normalize enums e.g. http.HTTPStatus
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 02 02:48:51 GMT 2024 - 170.1K bytes - Viewed (0) -
docs_src/generate_clients/tutorial003.py
from typing import List from fastapi import FastAPI from fastapi.routing import APIRoute from pydantic import BaseModel def custom_generate_unique_id(route: APIRoute): return f"{route.tags[0]}-{route.name}" app = FastAPI(generate_unique_id_function=custom_generate_unique_id) class Item(BaseModel): name: str price: float class ResponseMessage(BaseModel): message: str
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 04 22:02:18 GMT 2022 - 939 bytes - Viewed (0) -
fastapi/applications.py
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 02 02:48:51 GMT 2024 - 172.2K bytes - Viewed (0) -
fastapi/utils.py
stacklevel=2, ) operation_id = f"{name}{path}" operation_id = re.sub(r"\W", "_", operation_id) operation_id = f"{operation_id}_{method.lower()}" return operation_id def generate_unique_id(route: "APIRoute") -> str: operation_id = f"{route.name}{route.path_format}" operation_id = re.sub(r"\W", "_", operation_id) assert route.methods
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 7.8K bytes - Viewed (0) -
docs/en/docs/advanced/generate-clients.md
For example, here it is using the first tag (you will probably have only one tag) and the *path operation* name (the function name). You can then pass that custom function to **FastAPI** as the `generate_unique_id_function` parameter: === "Python 3.9+" ```Python hl_lines="6-7 10" {!> ../../../docs_src/generate_clients/tutorial003_py39.py!} ``` === "Python 3.8+"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 10.5K bytes - Viewed (0) -
docs/zh/docs/advanced/generate-clients.md
### 自定义生成唯一ID函数 FastAPI为每个*路径操作*使用一个**唯一ID**,它用于**操作ID**,也用于任何所需自定义模型的名称,用于请求或响应。 你可以自定义该函数。它接受一个 `APIRoute` 对象作为输入,并输出一个字符串。 例如,以下是一个示例,它使用第一个标签(你可能只有一个标签)和*路径操作*名称(函数名)。 然后,你可以将这个自定义函数作为 `generate_unique_id_function` 参数传递给 **FastAPI**: === "Python 3.9+" ```Python hl_lines="6-7 10" {!> ../../../docs_src/generate_clients/tutorial003_py39.py!} ``` === "Python 3.8+"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Apr 03 03:42:11 GMT 2024 - 9.1K bytes - Viewed (0) -
docs/de/docs/advanced/generate-clients.md
Hier verwendet sie beispielsweise den ersten Tag (Sie werden wahrscheinlich nur einen Tag haben) und den Namen der *Pfadoperation* (den Funktionsnamen). Anschließend können Sie diese benutzerdefinierte Funktion als Parameter `generate_unique_id_function` an **FastAPI** übergeben: === "Python 3.9+" ```Python hl_lines="6-7 10" {!> ../../../docs_src/generate_clients/tutorial003_py39.py!} ``` === "Python 3.8+"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Apr 03 03:42:11 GMT 2024 - 12K bytes - Viewed (0) -
docs/em/docs/advanced/generate-clients.md
👆 💪 🛃 👈 🔢. ⚫️ ✊ `APIRoute` & 🔢 🎻. 🖼, 📥 ⚫️ ⚙️ 🥇 🔖 (👆 🔜 🎲 ✔️ 🕴 1️⃣ 🔖) & *➡ 🛠️* 📛 (🔢 📛). 👆 💪 ⤴️ 🚶♀️ 👈 🛃 🔢 **FastAPI** `generate_unique_id_function` 🔢: === "🐍 3️⃣.6️⃣ & 🔛" ```Python hl_lines="8-9 12" {!> ../../../docs_src/generate_clients/tutorial003.py!} ``` === "🐍 3️⃣.9️⃣ & 🔛"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Apr 03 03:42:11 GMT 2024 - 8.4K bytes - Viewed (0)