feat: report compatibility evidence

This commit is contained in:
Sergey Antropoff
2026-07-12 23:45:55 +03:00
parent a64174910c
commit 355bb23d5e
4 changed files with 167 additions and 1 deletions
+9 -1
View File
@@ -7,6 +7,7 @@ from fastapi import FastAPI
from app.api.errors import ApiError, api_error_handler, unhandled_exception_handler
from app.api.middleware import RequestContextMiddleware
from app.api.registry import HandlerRegistry, register_contract_routes
from app.compatibility import build_report
from app.config import Settings, get_settings
from app.contracts.model import Snapshot
from app.lifespan import DatabaseFactory, create_lifespan, default_database_factory
@@ -34,12 +35,19 @@ def create_app(
app.include_router(health_router)
if resolved.contract_snapshot is not None:
snapshot = Snapshot.model_validate_json(resolved.contract_snapshot.read_bytes())
resolved_handlers = handlers or HandlerRegistry()
register_contract_routes(
app,
snapshot,
handlers or HandlerRegistry(),
resolved_handlers,
resolved.contract_fallback,
)
report = build_report(snapshot, implemented=resolved_handlers.keys())
@app.get("/admin/compatibility", include_in_schema=False)
async def compatibility_report() -> dict[str, object]:
return report.as_json()
return app