Files
fastapi_best_architecture/backend/utils/openapi.py
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
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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