kanade-backend 0.33.0

axum + SQLite projection backend for the kanade endpoint-management system. Hosts /api/* and the embedded SPA dashboard, projects JetStream streams into SQLite, drives the cron scheduler
//! JSON Schema endpoints. The SPA's Monaco editor wires
//! `monaco-yaml` to these URLs so operators get field-name
//! completion, hover docs, and inline validation against the
//! authoritative `Manifest` / `Schedule` Rust types instead of a
//! hand-curated schema that would inevitably rot.
//!
//! `schemars::schema_for!` walks the derived `JsonSchema` impls
//! once per request. The cost is negligible for an editor-open
//! workflow; if it ever shows up in a profile, wrap in `OnceLock`.

use axum::Json;
use axum::http::StatusCode;
use kanade_shared::manifest::{Manifest, Schedule};

pub async fn manifest_schema() -> Result<Json<serde_json::Value>, StatusCode> {
    let schema = schemars::schema_for!(Manifest);
    serde_json::to_value(&schema)
        .map(Json)
        .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
}

pub async fn schedule_schema() -> Result<Json<serde_json::Value>, StatusCode> {
    let schema = schemars::schema_for!(Schedule);
    serde_json::to_value(&schema)
        .map(Json)
        .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
}