feat: report compatibility evidence
This commit is contained in:
+9
-1
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user