fix: tighten binder/app route annotations (FastAPI/ModuleType); sync binder.pyi with signature; refresh MCP docs

This commit is contained in:
2026-09-14 00:04:23 +05:30
parent 48fd6627a7
commit adeb02e162
6 changed files with 68 additions and 31 deletions

View File

@@ -34,6 +34,7 @@ Notes:
import os
import re
from types import ModuleType
from typing import Any
from fastapi import FastAPI
@@ -106,7 +107,7 @@ class OpenAPIFirstApp(FastAPI):
self,
*,
openapi_path: str,
routes_module: Any,
routes_module: ModuleType,
**fastapi_kwargs: Any,
):
"""
@@ -116,7 +117,7 @@ class OpenAPIFirstApp(FastAPI):
openapi_path (str):
Filesystem path to the OpenAPI 3.x specification file. This
specification is treated as the authoritative API contract.
routes_module (Any):
routes_module (ModuleType):
Python module containing handler functions whose names correspond
exactly to OpenAPI ``operationId`` values.
**fastapi_kwargs (Any):

View File

@@ -32,28 +32,30 @@ Notes:
- Interpret OpenAPI semantics beyond routing metadata.
"""
from types import ModuleType
from typing import Any
from fastapi import FastAPI
from fastapi.routing import APIRoute
from .errors import MissingOperationHandler
def bind_routes(
app: Any,
spec: dict,
routes_module: Any,
app: FastAPI,
spec: dict[str, Any],
routes_module: ModuleType,
security_deps: dict[str, list[Any]] | None = None,
) -> None:
"""
Bind OpenAPI operations to FastAPI routes.
Args:
app (Any):
app (FastAPI):
The FastAPI application instance to which routes will be added.
spec (dict):
spec (dict[str, Any]):
Parsed OpenAPI 3.x specification dictionary.
routes_module (Any):
routes_module (ModuleType):
Python module containing handler functions. Each handler's name MUST
exactly match an OpenAPI `operationId`.
security_deps (dict[str, list[Any]] | None):

View File

@@ -1,5 +1,11 @@
from types import ModuleType
from typing import Any
from fastapi import FastAPI
def bind_routes(app: FastAPI, spec: dict[str, Any], routes_module: Any) -> None: ...
def bind_routes(
app: FastAPI,
spec: dict[str, Any],
routes_module: ModuleType,
security_deps: dict[str, list[Any]] | None = None,
) -> None: ...