dipper 0.5.3

An out-of-the-box modular dependency injection web application framework.
Documentation
pub use cubix::api_craft::errtype::*;
use dipper_macros::dipper;
use salvo::writing::Json;

static mut ERR_PATH_ROOT: ErrPathRoot = ErrPathRoot::X99("");

/// # Safety
/// Ensure that it is called only once before the service starts.
pub const unsafe fn init_err_root_path(err_root_path: ErrPathRoot) {
    ERR_PATH_ROOT = err_root_path;
}

thread_local! {
    pub static ERR_PATH_DIPPER: ErrPathParent = unsafe { ERR_PATH_ROOT }.Y01("dipper");
}

thread_local! {
    pub static ERR_PATH_AUTHN: ErrPath = ERR_PATH_DIPPER.with(|v|v.Z01("authn"));
}

/// Return API error code list.
#[dipper(endpoint(tags("error-code")))]
pub(crate) fn api_err_list() -> Json<serde_json::Value> {
    Json(serde_json::to_value(tally_err_decl().text_tree()).unwrap_or_default())
}

#[cfg(test)]
mod tests {
    #[test]
    fn err_decl_info() {
        let tally = super::tally_err_decl();
        println!("{}", tally.xml())
    }
}