From 9b043565b5dfa8a7f9573934ea9f8e5ccc6ea79d Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Tue, 20 Oct 2026 12:43:23 +0200 Subject: [PATCH] chore: Replace serde_yaml with yaml_serde --- CHANGELOG.md | 6 +++ Cargo.lock | 50 +++++++++---------- Cargo.toml | 2 +- trino-lb-core/Cargo.toml | 2 +- trino-lb-core/src/config.rs | 8 +-- trino-lb/Cargo.toml | 2 +- trino-lb/src/routing/client_tags.rs | 8 +-- .../src/routing/trino_routing_group_header.rs | 4 +- 8 files changed, 44 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a202d5..d15443f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Changed + +- Replace the deprecated `serde_yaml` crate with the maintained `yaml_serde` fork ([#123]). + +[#123]: https://github.com/stackabletech/trino-lb/pull/123 + ## [0.7.0] - 2026-08-03 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 0158aa7..7e99a54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1053,7 +1053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2089,6 +2089,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libyaml-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e126dda6f34391ab7b444f9922055facc83c07a910da3eb16f1e4d9c45dc777" + [[package]] name = "litemap" version = "0.8.2" @@ -2759,7 +2765,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3068,7 +3074,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3258,19 +3264,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "sha1" version = "0.10.7" @@ -4174,7 +4167,6 @@ dependencies = [ "rustls", "serde", "serde_json", - "serde_yaml", "snafu", "strum", "tokio", @@ -4188,6 +4180,7 @@ dependencies = [ "trino-rust-client", "url", "urlencoding", + "yaml_serde", ] [[package]] @@ -4217,12 +4210,12 @@ dependencies = [ "rstest", "serde", "serde_json", - "serde_yaml", "snafu", "strum", "tracing", "trino-rust-client", "url", + "yaml_serde", ] [[package]] @@ -4357,12 +4350,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - [[package]] name = "untrusted" version = "0.9.0" @@ -4581,7 +4568,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -4752,6 +4739,19 @@ version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aee1b19627c7c60102ab80d3a9cbe18de90bfe03bfa6c3715447681f0e8c8af6" +[[package]] +name = "yaml_serde" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b729a08a9a6be689bbad3e2bf8015926db54b6622cc89c3a5f7dc174b9e918" +dependencies = [ + "indexmap", + "itoa", + "libyaml-rs", + "ryu", + "serde", +] + [[package]] name = "yoke" version = "0.8.3" diff --git a/Cargo.toml b/Cargo.toml index b81c765..85d1443 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,6 @@ rustls = "0.23" rstest = "0.26" serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", features = ["raw_value"] } -serde_yaml = "0.9" snafu = "0.9" # 0.7.4 is the first release that includes https://github.com/launchbadge/sqlx/pull/2927 sqlx = { version = "0.9", features = [ @@ -100,6 +99,7 @@ trait-variant = "0.1" trino-rust-client = "0.11" url = { version = "2.5", features = ["serde"] } urlencoding = "2.1" +yaml_serde = "0.10" # For trino-lb-bench indicatif = "0.18" diff --git a/trino-lb-core/Cargo.toml b/trino-lb-core/Cargo.toml index db16a8d..bcdb073 100644 --- a/trino-lb-core/Cargo.toml +++ b/trino-lb-core/Cargo.toml @@ -18,13 +18,13 @@ opentelemetry-otlp.workspace = true rand.workspace = true reqwest.workspace = true serde_json.workspace = true -serde_yaml.workspace = true serde.workspace = true snafu.workspace = true strum.workspace = true tracing.workspace = true trino-rust-client.workspace = true url.workspace = true +yaml_serde.workspace = true [dev-dependencies] rstest.workspace = true diff --git a/trino-lb-core/src/config.rs b/trino-lb-core/src/config.rs index 97040b6..1f5a6b9 100644 --- a/trino-lb-core/src/config.rs +++ b/trino-lb-core/src/config.rs @@ -22,7 +22,7 @@ pub enum Error { #[snafu(display("Failed to parse configuration file at {config_file:?}"))] ParseConfigFile { - source: serde_yaml::Error, + source: yaml_serde::Error, config_file: PathBuf, }, } @@ -361,14 +361,14 @@ pub struct StackableCluster { } impl Config { - /// Using [`std::fs::File`] over `tokio::fs::File`, as [`serde_yaml::from_reader`] does not support + /// Using [`std::fs::File`] over `tokio::fs::File`, as [`yaml_serde::from_reader`] does not support /// async yet (?). Should not matter, as we only read the config once during startup. pub async fn read_from_file(config_file: &PathBuf) -> Result { let config_file_content = File::open(config_file).context(ReadConfigFileSnafu { config_file })?; - let deserializer = serde_yaml::Deserializer::from_reader(config_file_content); - serde_yaml::with::singleton_map_recursive::deserialize(deserializer) + let deserializer = yaml_serde::Deserializer::from_reader(config_file_content); + yaml_serde::with::singleton_map_recursive::deserialize(deserializer) .context(ParseConfigFileSnafu { config_file }) } } diff --git a/trino-lb/Cargo.toml b/trino-lb/Cargo.toml index fb0cb47..1411e55 100644 --- a/trino-lb/Cargo.toml +++ b/trino-lb/Cargo.toml @@ -43,7 +43,6 @@ regex.workspace = true reqwest.workspace = true rustls.workspace = true serde_json.workspace = true -serde_yaml.workspace = true serde.workspace = true snafu.workspace = true strum.workspace = true @@ -56,6 +55,7 @@ tracing.workspace = true trino-rust-client.workspace = true url.workspace = true urlencoding.workspace = true +yaml_serde.workspace = true [dev-dependencies] indoc.workspace = true diff --git a/trino-lb/src/routing/client_tags.rs b/trino-lb/src/routing/client_tags.rs index 5050d56..3f301b9 100644 --- a/trino-lb/src/routing/client_tags.rs +++ b/trino-lb/src/routing/client_tags.rs @@ -98,7 +98,7 @@ mod tests { #[case] x_trino_client_tags: Option<&str>, #[case] expected: Option<&str>, ) { - let config = serde_yaml::from_str( + let config = yaml_serde::from_str( r#" trinoClusterGroup: my-target oneOf: ["foo", "bar", "bak", "system=airflow"] @@ -135,7 +135,7 @@ mod tests { #[case] x_trino_client_tags: Option<&str>, #[case] expected: Option<&str>, ) { - let config = serde_yaml::from_str( + let config = yaml_serde::from_str( r#" trinoClusterGroup: my-target allOf: ["foo", "bar", "bak", "system=airflow"] @@ -161,7 +161,7 @@ mod tests { /// Seems like whatever comes first takes precedence #[test] fn test_configuring_one_of_and_all_of() { - let config: ClientTagsRouterConfig = serde_yaml::from_str( + let config: ClientTagsRouterConfig = yaml_serde::from_str( r#" trinoClusterGroup: my-target allOf: ["allOf"] @@ -174,7 +174,7 @@ mod tests { TagMatchingStrategy::AllOf(_) )); - let config: ClientTagsRouterConfig = serde_yaml::from_str( + let config: ClientTagsRouterConfig = yaml_serde::from_str( r#" trinoClusterGroup: my-target oneOf: ["oneOf"] diff --git a/trino-lb/src/routing/trino_routing_group_header.rs b/trino-lb/src/routing/trino_routing_group_header.rs index b0c3a7e..ca69b5a 100644 --- a/trino-lb/src/routing/trino_routing_group_header.rs +++ b/trino-lb/src/routing/trino_routing_group_header.rs @@ -63,7 +63,7 @@ mod tests { #[case(Some("bar,bak"))] #[tokio::test] async fn test_standard_header(#[case] x_trino_routing_group: Option<&str>) { - let config = serde_yaml::from_str("").unwrap(); + let config = yaml_serde::from_str("").unwrap(); let valid_target_groups = HashSet::from(["foo".to_string(), "bar,bak".to_string()]); let router = TrinoRoutingGroupHeaderRouter::new(&config, valid_target_groups); @@ -115,7 +115,7 @@ mod tests { #[tokio::test] async fn test_target_group_does_not_exist() { - let config = serde_yaml::from_str("").unwrap(); + let config = yaml_serde::from_str("").unwrap(); let valid_target_groups = HashSet::from(["foo".to_string()]); let router = TrinoRoutingGroupHeaderRouter::new(&config, valid_target_groups);