athena_rs 3.26.1

Hyper performant polyglot Database driver
Documentation
//! `/debug/schema` HTTP handler.
//!
//! This module keeps handler flow focused while request auth-gating is
//! delegated to `debug_route_handler_auth_gate` and response handoff is
//! delegated to `debug_route_handler_output_handoff_assembly`.

use actix_web::{HttpRequest, HttpResponse, get, web};
use web::Data;

use crate::AppState;

use super::debug_route_handler_auth_gate::authorize_debug_schema_request;
use super::debug_route_handler_output_handoff_assembly::build_debug_schema_handler_response;

/// Returns logging-client schema diagnostics with expected-vs-observed details.
///
/// Requires static admin key or gateway API key with read access.
#[get("/debug/schema")]
pub(super) async fn debug_schema(req: HttpRequest, app_state: Data<AppState>) -> HttpResponse {
    if let Err(resp) = authorize_debug_schema_request(&req, app_state.get_ref()).await {
        return resp;
    }

    build_debug_schema_handler_response(app_state.get_ref()).await
}