aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2026-03-31 21:35:49 +0200
committerrtkay123 <dev@kanjala.com>2026-03-31 21:35:49 +0200
commit2c336f0339747aa77a8fe6613b83200c8d4902a5 (patch)
tree5e77ac42c48c455fd9869df6baf39c0887f6d8e6
parentcec58d78e968250e4c589899eab460d1132f6d01 (diff)
downloadwarden-2c336f0339747aa77a8fe6613b83200c8d4902a5.tar.bz2
warden-2c336f0339747aa77a8fe6613b83200c8d4902a5.zip
test(config): schema
-rw-r--r--Cargo.lock33
-rw-r--r--Cargo.toml1
-rw-r--r--lib/api-config/Cargo.toml3
-rw-r--r--lib/api-config/src/lib.rs2
-rw-r--r--lib/api-config/src/schema/create_schema.rs (renamed from lib/api-config/src/schema/create.rs)27
-rw-r--r--lib/api-config/src/schema/delete_schema.rs19
-rw-r--r--lib/api-config/src/schema/get_schema.rs26
-rw-r--r--lib/api-config/src/schema/implementation.rs84
-rw-r--r--lib/api-config/src/schema/mod.rs192
-rw-r--r--lib/api-config/src/schema/update_schema.rs34
-rw-r--r--lib/api-config/tests/fixtures/schema.sql12
-rw-r--r--warden/Cargo.toml2
-rw-r--r--warden/src/server/mod.rs3
-rw-r--r--warden/src/server/routes/config/logs.rs5
-rw-r--r--warden/src/server/routes/config/schema/create.rs18
-rw-r--r--warden/src/server/routes/config/schema/delete.rs13
-rw-r--r--warden/src/server/routes/config/schema/read.rs17
-rw-r--r--warden/src/server/routes/config/schema/update.rs15
-rw-r--r--warden/src/server/routes/transaction_monitoring/monitor.rs15
19 files changed, 342 insertions, 179 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 442384b..3acbf03 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -97,6 +97,7 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
name = "api-config"
version = "0.1.0"
dependencies = [
+ "anyhow",
"async-trait",
"serde",
"serde_json",
@@ -1227,9 +1228,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.92"
+version = "0.3.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc4c90f45aa2e6eacbe8645f77fdea542ac97a494bcd117a67df9ff4d611f995"
+checksum = "797146bb2677299a1eb6b7b50a890f4c361b29ef967addf5b2fa45dae1bb6d7d"
dependencies = [
"cfg-if",
"futures-util",
@@ -3142,9 +3143,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
-version = "0.2.115"
+version = "0.2.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6523d69017b7633e396a89c5efab138161ed5aafcbc8d3e5c5a42ae38f50495a"
+checksum = "7dc0882f7b5bb01ae8c5215a1230832694481c1a4be062fd410e12ea3da5b631"
dependencies = [
"cfg-if",
"once_cell",
@@ -3155,9 +3156,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.65"
+version = "0.4.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d1faf851e778dfa54db7cd438b70758eba9755cb47403f3496edd7c8fc212f0"
+checksum = "19280959e2844181895ef62f065c63e0ca07ece4771b53d89bfdb967d97cbf05"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -3165,9 +3166,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.115"
+version = "0.2.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e3a6c758eb2f701ed3d052ff5737f5bfe6614326ea7f3bbac7156192dc32e67"
+checksum = "75973d3066e01d035dbedaad2864c398df42f8dd7b1ea057c35b8407c015b537"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -3175,9 +3176,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.115"
+version = "0.2.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "921de2737904886b52bcbb237301552d05969a6f9c40d261eb0533c8b055fedf"
+checksum = "91af5e4be765819e0bcfee7322c14374dc821e35e72fa663a830bbc7dc199eac"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -3188,9 +3189,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.115"
+version = "0.2.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a93e946af942b58934c604527337bad9ae33ba1d5c6900bbb41c2c07c2364a93"
+checksum = "c9bf0406a78f02f336bf1e451799cca198e8acde4ffa278f0fb20487b150a633"
dependencies = [
"unicode-ident",
]
@@ -3231,9 +3232,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.92"
+version = "0.3.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84cde8507f4d7cfcb1185b8cb5890c494ffea65edbe1ba82cfd63661c805ed94"
+checksum = "749466a37ee189057f54748b200186b59a03417a117267baf3fd89cecc9fb837"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -3507,9 +3508,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8"
+checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5"
[[package]]
name = "wit-bindgen"
diff --git a/Cargo.toml b/Cargo.toml
index ee33a0d..bc284e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,7 @@ homepage = "https://git.kanjala.com/warden"
publish = false
[workspace.dependencies]
+anyhow = "1.0.102"
async-trait = "0.1.89"
clap = "4.6.0"
jsonschema = "0.45.0"
diff --git a/lib/api-config/Cargo.toml b/lib/api-config/Cargo.toml
index b114944..6724306 100644
--- a/lib/api-config/Cargo.toml
+++ b/lib/api-config/Cargo.toml
@@ -18,6 +18,9 @@ tracing.workspace = true
utoipa = { workspace = true, optional = true }
warden-core.workspace = true
+[dev-dependencies]
+anyhow.workspace = true
+
[features]
default = []
utoipa = ["dep:utoipa", "utoipa/time"]
diff --git a/lib/api-config/src/lib.rs b/lib/api-config/src/lib.rs
index 84366c1..0d0117a 100644
--- a/lib/api-config/src/lib.rs
+++ b/lib/api-config/src/lib.rs
@@ -1,3 +1,5 @@
mod error;
pub mod schema;
pub use error::ConfigurationError;
+
+pub(crate) static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!("../../migrations");
diff --git a/lib/api-config/src/schema/create.rs b/lib/api-config/src/schema/create_schema.rs
index e6511d5..493fb09 100644
--- a/lib/api-config/src/schema/create.rs
+++ b/lib/api-config/src/schema/create_schema.rs
@@ -1,4 +1,10 @@
use serde::{Deserialize, Serialize};
+use tracing::debug;
+
+use crate::{
+ ConfigurationError,
+ schema::{SchemaService, TransactionSchema},
+};
#[derive(Deserialize, Serialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
@@ -41,3 +47,24 @@ pub struct CreateSchema {
/// The json schema
pub schema: serde_json::Value,
}
+
+pub(super) async fn create_schema(
+ state: &SchemaService,
+ kind: &str,
+ version: &str,
+ schema: &serde_json::Value,
+) -> Result<TransactionSchema, ConfigurationError> {
+ debug!("creating transaction schema");
+ sqlx::query_as!(
+ TransactionSchema,
+ "insert into transaction_schema (schema_type, schema_version, schema) values ($1, $2, $3)
+ returning *
+ ",
+ kind,
+ version,
+ sqlx::types::Json(&schema) as _
+ )
+ .fetch_one(&state.database)
+ .await
+ .map_err(|e| e.into())
+}
diff --git a/lib/api-config/src/schema/delete_schema.rs b/lib/api-config/src/schema/delete_schema.rs
new file mode 100644
index 0000000..86e71d5
--- /dev/null
+++ b/lib/api-config/src/schema/delete_schema.rs
@@ -0,0 +1,19 @@
+use tracing::debug;
+
+use crate::{ConfigurationError, schema::SchemaService};
+
+pub(super) async fn delete_schema(
+ state: &SchemaService,
+ kind: &str,
+ version: &str,
+) -> Result<(), ConfigurationError> {
+ debug!("deleting transaction schema");
+ sqlx::query!(
+ "delete from transaction_schema where schema_type = $1 and schema_version = $2",
+ kind,
+ version,
+ )
+ .execute(&state.database)
+ .await?;
+ Ok(())
+}
diff --git a/lib/api-config/src/schema/get_schema.rs b/lib/api-config/src/schema/get_schema.rs
new file mode 100644
index 0000000..427a02f
--- /dev/null
+++ b/lib/api-config/src/schema/get_schema.rs
@@ -0,0 +1,26 @@
+use tracing::debug;
+
+use crate::{
+ ConfigurationError,
+ schema::{SchemaService, TransactionSchema},
+};
+
+pub(super) async fn get_schema(
+ state: &SchemaService,
+ kind: &str,
+ version: &str,
+) -> Result<Option<TransactionSchema>, ConfigurationError> {
+ debug!("getting transaction schema");
+ let result = sqlx::query_as!(
+ TransactionSchema,
+ "select
+ *
+ from transaction_schema where schema_type = $1 and schema_version = $2",
+ kind,
+ version,
+ )
+ .fetch_optional(&state.database)
+ .await?;
+
+ Ok(result)
+}
diff --git a/lib/api-config/src/schema/implementation.rs b/lib/api-config/src/schema/implementation.rs
new file mode 100644
index 0000000..c414879
--- /dev/null
+++ b/lib/api-config/src/schema/implementation.rs
@@ -0,0 +1,84 @@
+use async_trait::async_trait;
+use tracing::debug;
+
+use crate::schema::{self, SchemaDriver, SchemaService, TransactionSchema};
+
+#[async_trait]
+impl SchemaDriver for SchemaService {
+ #[tracing::instrument(skip(self, schema))]
+ async fn create_schema(
+ &self,
+ kind: &str,
+ version: &str,
+ schema: &serde_json::Value,
+ ) -> Result<TransactionSchema, crate::ConfigurationError> {
+ schema::create_schema::create_schema(self, kind, version, schema).await
+ }
+
+ #[tracing::instrument(skip(self))]
+ async fn delete_schema(
+ &self,
+ kind: &str,
+ version: &str,
+ ) -> Result<(), crate::ConfigurationError> {
+ schema::delete_schema::delete_schema(self, kind, version).await
+ }
+
+ #[tracing::instrument(skip(self))]
+ async fn get_schema(
+ &self,
+ kind: &str,
+ version: &str,
+ ) -> Result<Option<TransactionSchema>, crate::ConfigurationError> {
+ schema::get_schema::get_schema(self, kind, version).await
+ }
+
+ #[tracing::instrument(skip(self, schema))]
+ async fn update_schema(
+ &self,
+ kind: &str,
+ version: &str,
+ schema: &serde_json::Value,
+ ) -> Result<Option<TransactionSchema>, crate::ConfigurationError> {
+ schema::update_schema::update_schema(self, kind, version, schema).await
+ }
+
+ #[tracing::instrument(skip(self))]
+ async fn get_schemas(
+ &self,
+ limit: i64,
+ first: Option<i64>,
+ after: Option<&str>,
+ ) -> Result<Vec<TransactionSchema>, crate::ConfigurationError> {
+ debug!("getting transaction schemas");
+ let limit = first.unwrap_or(limit);
+ let mut last_type = String::default();
+ let mut last_version = String::default();
+
+ if let Some(s) = after {
+ let parts: Vec<&str> = s.split(',').collect();
+ if parts.len() == 2 {
+ last_type = parts[0].to_string();
+ last_version = parts[1].to_string();
+ }
+ }
+
+ let rows = sqlx::query_as!(
+ TransactionSchema,
+ "
+ select *
+ from transaction_schema
+ where ($1 = '' or (schema_type, schema_version) > ($1, $2))
+ order by schema_type asc, schema_version asc
+ limit $3
+ ",
+ &last_type,
+ &last_version,
+ limit + 1
+ )
+ .fetch_all(&self.database)
+ .await?;
+
+ Ok(rows)
+ }
+}
diff --git a/lib/api-config/src/schema/mod.rs b/lib/api-config/src/schema/mod.rs
index f626e87..d16ee9f 100644
--- a/lib/api-config/src/schema/mod.rs
+++ b/lib/api-config/src/schema/mod.rs
@@ -1,7 +1,10 @@
-mod create;
-pub use create::CreateSchema;
+mod create_schema;
+mod delete_schema;
+mod get_schema;
+mod implementation;
+mod update_schema;
+pub use create_schema::CreateSchema;
use sqlx::PgPool;
-use tracing::debug;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
@@ -96,133 +99,64 @@ pub trait SchemaDriver: Send + Sync {
) -> Result<Vec<TransactionSchema>, ConfigurationError>;
}
-#[async_trait]
-impl SchemaDriver for SchemaService {
- #[tracing::instrument(skip(self, schema))]
- async fn create_schema(
- &self,
- kind: &str,
- version: &str,
- schema: &serde_json::Value,
- ) -> Result<TransactionSchema, crate::ConfigurationError> {
- debug!("creating transaction schema");
- sqlx::query_as!(
- TransactionSchema,
- "insert into transaction_schema (schema_type, schema_version, schema) values ($1, $2, $3)
- returning *
- ",
- kind,
- version,
- sqlx::types::Json(&schema) as _
- )
- .fetch_one(&self.database)
- .await
- .map_err(|e| e.into())
- }
+#[cfg(test)]
+mod tests {
+ use sqlx::PgPool;
+
+ use crate::schema::{SchemaDriver, SchemaService};
+
+ #[sqlx::test(
+ migrator = "crate::MIGRATOR",
+ fixtures(path = "../../tests/fixtures", scripts("schema"))
+ )]
+ async fn schema(pool: PgPool) -> anyhow::Result<()> {
+ let driver = SchemaService { database: pool };
+
+ // 2. Define Fixtures
+ let kind = "fin_tx_v1";
+ let version = "1.0.0";
+ let min_schema = serde_json::json!({
+ "type": "object",
+ "required": ["amount", "currency"],
+ "properties": {
+ "amount": { "type": "integer" },
+ "ccy": { "type": "string" }
+ }
+ });
+
+ // CREATE
+ let created = driver
+ .create_schema(kind, version, &min_schema)
+ .await
+ .expect("Create failed");
+ assert_eq!(created.schema_type, kind);
+
+ // GET
+ let found = driver
+ .get_schema("payment", "1.0.0")
+ .await
+ .expect("Get failed")
+ .expect("Schema missing");
+ assert_eq!(found.schema["required"], min_schema["required"]);
+
+ // UPDATE
+ let updated_json = serde_json::json!({"type": "object", "note": "updated"});
+ let updated = driver
+ .update_schema(kind, version, &updated_json)
+ .await
+ .expect("Update failed")
+ .expect("No row to update");
+ assert_eq!(updated.schema["note"], "updated");
+
+ // DELETE
+ driver
+ .delete_schema(kind, version)
+ .await
+ .expect("Delete failed");
+
+ let final_check = driver.get_schema(kind, version).await.unwrap();
+ assert!(final_check.is_none());
- #[tracing::instrument(skip(self))]
- async fn delete_schema(
- &self,
- kind: &str,
- version: &str,
- ) -> Result<(), crate::ConfigurationError> {
- debug!("deleting transaction schema");
- sqlx::query!(
- "delete from transaction_schema where schema_type = $1 and schema_version = $2",
- kind,
- version,
- )
- .execute(&self.database)
- .await?;
Ok(())
}
-
- #[tracing::instrument(skip(self))]
- async fn get_schema(
- &self,
- kind: &str,
- version: &str,
- ) -> Result<Option<TransactionSchema>, crate::ConfigurationError> {
- debug!("getting transaction schema");
- let result = sqlx::query_as!(
- TransactionSchema,
- "select
- *
- from transaction_schema where schema_type = $1 and schema_version = $2",
- kind,
- version,
- )
- .fetch_optional(&self.database)
- .await?;
-
- Ok(result)
- }
-
- #[tracing::instrument(skip(self, schema))]
- async fn update_schema(
- &self,
- kind: &str,
- version: &str,
- schema: &serde_json::Value,
- ) -> Result<Option<TransactionSchema>, crate::ConfigurationError> {
- debug!("updating transaction schema");
- sqlx::query_as!(
- TransactionSchema,
- "
- update
- transaction_schema
- set
- schema = $3
- where
- schema_type = $1
- and schema_version = $2
- returning *
- ",
- kind,
- version,
- sqlx::types::Json(&schema) as _
- )
- .fetch_optional(&self.database)
- .await
- .map_err(|e| e.into())
- }
-
- #[tracing::instrument(skip(self))]
- async fn get_schemas(
- &self,
- limit: i64,
- first: Option<i64>,
- after: Option<&str>,
- ) -> Result<Vec<TransactionSchema>, ConfigurationError> {
- debug!("getting transaction schemas");
- let limit = first.unwrap_or(limit);
- let mut last_type = String::default();
- let mut last_version = String::default();
-
- if let Some(s) = after {
- let parts: Vec<&str> = s.split(',').collect();
- if parts.len() == 2 {
- last_type = parts[0].to_string();
- last_version = parts[1].to_string();
- }
- }
-
- let rows = sqlx::query_as!(
- TransactionSchema,
- "
- select *
- from transaction_schema
- where ($1 = '' or (schema_type, schema_version) > ($1, $2))
- order by schema_type asc, schema_version asc
- limit $3
- ",
- &last_type,
- &last_version,
- limit + 1
- )
- .fetch_all(&self.database)
- .await?;
-
- Ok(rows)
- }
}
diff --git a/lib/api-config/src/schema/update_schema.rs b/lib/api-config/src/schema/update_schema.rs
new file mode 100644
index 0000000..4aa0862
--- /dev/null
+++ b/lib/api-config/src/schema/update_schema.rs
@@ -0,0 +1,34 @@
+use tracing::debug;
+
+use crate::{
+ ConfigurationError,
+ schema::{SchemaService, TransactionSchema},
+};
+
+pub(super) async fn update_schema(
+ state: &SchemaService,
+ kind: &str,
+ version: &str,
+ schema: &serde_json::Value,
+) -> Result<Option<TransactionSchema>, ConfigurationError> {
+ debug!("updating transaction schema");
+ sqlx::query_as!(
+ TransactionSchema,
+ "
+ update
+ transaction_schema
+ set
+ schema = $3
+ where
+ schema_type = $1
+ and schema_version = $2
+ returning *
+ ",
+ kind,
+ version,
+ sqlx::types::Json(&schema) as _
+ )
+ .fetch_optional(&state.database)
+ .await
+ .map_err(|e| e.into())
+}
diff --git a/lib/api-config/tests/fixtures/schema.sql b/lib/api-config/tests/fixtures/schema.sql
new file mode 100644
index 0000000..4ec082e
--- /dev/null
+++ b/lib/api-config/tests/fixtures/schema.sql
@@ -0,0 +1,12 @@
+insert into transaction_schema (schema_type, schema_version, schema)
+values
+(
+ 'payment',
+ '1.0.0',
+ '{"type": "object", "required": ["amount", "currency"], "properties": {"amount": {"type": "number"}, "currency": {"type": "string"}}}'
+),
+(
+ 'refund',
+ '1.0.0',
+ '{"type": "object", "required": ["original_txn_id"], "properties": {"original_txn_id": {"type": "string"}}}'
+);
diff --git a/warden/Cargo.toml b/warden/Cargo.toml
index e373fb8..d4dcf8b 100644
--- a/warden/Cargo.toml
+++ b/warden/Cargo.toml
@@ -7,7 +7,7 @@ documentation.workspace = true
homepage.workspace = true
[dependencies]
-anyhow = "1.0.102"
+anyhow.workspace = true
axum = { version = "0.8.8", features = ["macros"] }
base64 = "0.22.1"
clap.workspace = true
diff --git a/warden/src/server/mod.rs b/warden/src/server/mod.rs
index 8c68ed8..fe93352 100644
--- a/warden/src/server/mod.rs
+++ b/warden/src/server/mod.rs
@@ -19,7 +19,8 @@ use crate::{
server::{
middleware::request_id::{REQUEST_ID_HEADER, middleware_request_id},
routes::{ApiDoc, config::ConfigDoc, transaction_monitoring::MonitoringDoc},
- }, state::AppState,
+ },
+ state::AppState,
};
pub mod api;
diff --git a/warden/src/server/routes/config/logs.rs b/warden/src/server/routes/config/logs.rs
index 9e8b2a6..0f2cbf8 100644
--- a/warden/src/server/routes/config/logs.rs
+++ b/warden/src/server/routes/config/logs.rs
@@ -4,7 +4,10 @@ use axum::{extract::State, http::StatusCode};
use serde::Deserialize;
use utoipa::ToSchema;
-use crate::{server::{api::SafeJson, routes::config::CONFIG}, state::AppState};
+use crate::{
+ server::{api::SafeJson, routes::config::CONFIG},
+ state::AppState,
+};
#[derive(Deserialize, Debug, Clone, ToSchema)]
/// Log level
diff --git a/warden/src/server/routes/config/schema/create.rs b/warden/src/server/routes/config/schema/create.rs
index d864f32..aa22546 100644
--- a/warden/src/server/routes/config/schema/create.rs
+++ b/warden/src/server/routes/config/schema/create.rs
@@ -1,6 +1,6 @@
use std::sync::Arc;
-use api_config::schema::{CreateSchema, SchemaDriver, TransactionSchema};
+use api_config::schema::{CreateSchema, TransactionSchema};
use axum::{
Json, debug_handler,
extract::{Path, State},
@@ -9,11 +9,14 @@ use axum::{
};
use tracing::{info, trace};
-use crate::{server::{
- api::version::{Version, VersionPath},
- error::AppError,
- routes::config::CONFIG,
-}, state::AppState};
+use crate::{
+ server::{
+ api::version::{Version, VersionPath},
+ error::AppError,
+ routes::config::CONFIG,
+ },
+ state::AppState,
+};
/// Save a transaction's schema
#[utoipa::path(
@@ -90,7 +93,8 @@ pub async fn create_schema(
})?;
info!("schema is valid. trying to save...");
- let result = state.schema_service
+ let result = state
+ .schema_service
.create_schema(&body.schema_type, &body.schema_version, &body.schema)
.await
.map_err(|e| match e {
diff --git a/warden/src/server/routes/config/schema/delete.rs b/warden/src/server/routes/config/schema/delete.rs
index 8fcc807..98fd581 100644
--- a/warden/src/server/routes/config/schema/delete.rs
+++ b/warden/src/server/routes/config/schema/delete.rs
@@ -10,11 +10,14 @@ use axum::{
use serde::{Deserialize, Serialize};
use utoipa::{IntoParams, ToSchema};
-use crate::{server::{
- api::version::{Version, VersionPath},
- error::AppError,
- routes::config::CONFIG,
-}, state::AppState};
+use crate::{
+ server::{
+ api::version::{Version, VersionPath},
+ error::AppError,
+ routes::config::CONFIG,
+ },
+ state::AppState,
+};
/// Schema delete query
#[derive(Deserialize, Serialize, IntoParams, ToSchema)]
diff --git a/warden/src/server/routes/config/schema/read.rs b/warden/src/server/routes/config/schema/read.rs
index a80f88f..c89583b 100644
--- a/warden/src/server/routes/config/schema/read.rs
+++ b/warden/src/server/routes/config/schema/read.rs
@@ -10,14 +10,17 @@ use axum::{
use base64::{Engine, engine::general_purpose};
use tracing::debug;
-use crate::{server::{
- api::{
- pagination::{PageInfo, PaginationParams, RelayResponse},
- version::{Version, VersionPath},
+use crate::{
+ server::{
+ api::{
+ pagination::{PageInfo, PaginationParams, RelayResponse},
+ version::{Version, VersionPath},
+ },
+ error::AppError,
+ routes::config::CONFIG,
},
- error::AppError,
- routes::config::CONFIG,
-}, state::AppState};
+ state::AppState,
+};
/// Get a transaction's schema
#[utoipa::path(
diff --git a/warden/src/server/routes/config/schema/update.rs b/warden/src/server/routes/config/schema/update.rs
index aaf1773..13f9fe9 100644
--- a/warden/src/server/routes/config/schema/update.rs
+++ b/warden/src/server/routes/config/schema/update.rs
@@ -8,11 +8,14 @@ use axum::{
response::IntoResponse,
};
-use crate::{server::{
- api::version::{Version, VersionPath},
- error::AppError,
- routes::config::CONFIG,
-}, state::AppState};
+use crate::{
+ server::{
+ api::version::{Version, VersionPath},
+ error::AppError,
+ routes::config::CONFIG,
+ },
+ state::AppState,
+};
/// Update a transaction's schema
#[utoipa::path(
@@ -55,7 +58,7 @@ use crate::{server::{
)
)
),
- operation_id = "delete_schema", // https://github.com/juhaku/utoipa/issues/1170
+ operation_id = "update_schema", // https://github.com/juhaku/utoipa/issues/1170
tag = CONFIG,
request_body(
content = CreateSchema
diff --git a/warden/src/server/routes/transaction_monitoring/monitor.rs b/warden/src/server/routes/transaction_monitoring/monitor.rs
index dedb6b1..66075f5 100644
--- a/warden/src/server/routes/transaction_monitoring/monitor.rs
+++ b/warden/src/server/routes/transaction_monitoring/monitor.rs
@@ -1,12 +1,15 @@
use std::sync::Arc;
-use crate::{server::{
- api::{
- transaction::Transaction,
- version::{Version, VersionPath},
+use crate::{
+ server::{
+ api::{
+ transaction::Transaction,
+ version::{Version, VersionPath},
+ },
+ middleware::extractors::transaction::ValidatedTransaction,
},
- middleware::extractors::transaction::ValidatedTransaction,
-}, state::AppState};
+ state::AppState,
+};
use axum::{
extract::{Path, State},
http::StatusCode,