mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-21 10:13:53 +08:00
15 lines
293 B
Python
15 lines
293 B
Python
from fastapi import FastAPI
|
|
from fastapi.routing import APIRoute
|
|
|
|
|
|
def custom_generate_unique_id(route: APIRoute) -> str:
|
|
return route.name
|
|
|
|
|
|
app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items():
|
|
return [{"item_id": "Foo"}]
|