Files
fastapi-best-architecture/backend/utils/openapi.py
T
Wu Clan 5762834744 Update the ruff rules and format the code (#846)
* Update the ruff rules and format the code

* Update the per-file-ignores

* Update the ci

* Update rules

* Fix codes

* Fix pagination

* Update rules
2025-10-10 19:02:49 +08:00

15 lines
379 B
Python

from fastapi import FastAPI
from fastapi.routing import APIRoute
def simplify_operation_ids(app: FastAPI) -> None:
"""
简化操作 ID,以便生成的客户端具有更简单的 API 函数名称
:param app: FastAPI 应用实例
:return:
"""
for route in app.routes:
if isinstance(route, APIRoute):
route.operation_id = route.name