mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
feat(api): generate unique readable OpenAPI operationIds
This commit is contained in:
5 files changed
+149
-4
No files matched your search
@@ -36,6 +36,7 @@ from uvicorn.main import Server as UvicornServer
|
||||
|
||||
# MCP is an optional feature — import only if dependencies are installed
|
||||
from gns3server.agent import MCP_AVAILABLE
|
||||
from gns3server.api.operation_ids import add_stub_routes, generate_operation_id
|
||||
from gns3server.api.routes import controller, index
|
||||
from gns3server.api.routes.compute import compute_api
|
||||
from gns3server.controller.controller_error import (
|
||||
@@ -58,13 +59,14 @@ else:
|
||||
|
||||
_mcp_router = APIRouter(prefix="/mcp", tags=["MCP"])
|
||||
|
||||
@_mcp_router.api_route("/{path:path}", methods=["GET", "POST", "DELETE", "PATCH", "PUT"])
|
||||
async def mcp_not_available(path: str = ""):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_501_NOT_IMPLEMENTED,
|
||||
detail="MCP is not available. Install AI dependencies with: pip install gns3-server[ai-features]",
|
||||
)
|
||||
|
||||
add_stub_routes(_mcp_router, mcp_not_available, "not_available")
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
@@ -80,6 +82,7 @@ def get_application() -> FastAPI:
|
||||
version="3.0.0",
|
||||
docs_url=None,
|
||||
redoc_url=None,
|
||||
generate_unique_id_function=generate_operation_id,
|
||||
)
|
||||
|
||||
application.add_middleware(
|
||||
|
||||
Reference in new issue
Block a user