diff --git a/Cargo.lock b/Cargo.lock index 47b6c0c3f..a494e5308 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -772,7 +772,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1259,7 +1259,7 @@ checksum = "69e0cd8a998937e25c6ba7cc276b96ec5cc3f4dc4ab5de9ede4fb152bdd5c5eb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3711,7 +3711,7 @@ checksum = "bf9f5f225956dc2254c6c27500deac9390a066b2e8a1a571300627a7c4400a33" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] diff --git a/shotover-proxy/src/config/chain.rs b/shotover-proxy/src/config/chain.rs index de3186ff2..ed76e91a8 100644 --- a/shotover-proxy/src/config/chain.rs +++ b/shotover-proxy/src/config/chain.rs @@ -22,6 +22,25 @@ impl TransformChainConfig { } } +/// This function is a custom deserializer that works around a mismatch in the way yaml and typetag represent things, +/// resulting in typetagged structs with no fields failing to deserialize from a single line yaml entry. +/// e.g. with typetag + yaml + the default serializer: +/// this would fail to deserialize: +/// ```yaml +/// chain_config: +/// redis_chain: +/// - NullSink +/// ``` +/// +/// but this would work fine: +/// ```yaml +/// chain_config: +/// redis_chain: +/// - NullSink: {} +/// ``` +/// +/// With the use of this custom deserializer both cases now deserialize correctly. +/// The implementation was a suggestion from dtolnay: https://github.com/dtolnay/typetag/pull/40#issuecomment-1454961686 fn vec_transform_config<'de, D>(deserializer: D) -> Result>, D::Error> where D: Deserializer<'de>,