summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2c9fa91..1ccecf7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,21 +11,21 @@ pub mod error;
pub mod service;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "lowercase")]
+#[serde(rename_all = "lowercase", tag = "status", content = "output")]
pub enum Status {
#[default]
Pass,
- Fail,
- Warn,
+ Fail(Option<String>),
+ Warn(Option<String>),
}
-#[derive(Debug, Clone, Default, Serialize, Deserialize)]
-pub struct Check {
- pub status: Status,
- pub output: Option<String>,
+impl<T: std::error::Error> From<T> for Status {
+ fn from(value: T) -> Self {
+ Status::Fail(Some(value.to_string()))
+ }
}
-impl axum::response::IntoResponse for Check {
+impl axum::response::IntoResponse for Status {
fn into_response(self) -> axum::response::Response {
axum::Json(self).into_response()
}