From 21f08620084bfe1f8b3b13d3013682130788db14 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Wed, 25 Mar 2026 16:42:41 +0100 Subject: [PATCH 1/2] fix: Return value for custom-time/numeric formatios for /v1/load annotations --- rust/cubeorchestrator/src/transport.rs | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index a85f1399f21be..f6db688fa64ad 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -97,6 +97,8 @@ pub struct ExtendedDimensionFormat { pub label: Option, #[serde(rename = "type")] pub format_type: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -319,3 +321,39 @@ pub struct TransformDataRequest { } pub type JsRawData = Vec>; + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + #[test] + fn test_dimension_format_custom_numeric() { + let json = json!({"type": "custom-numeric", "value": ".2f"}); + let format: DimensionFormat = serde_json::from_value(json).unwrap(); + + // Round-trip + let serialized = serde_json::to_value(&format).unwrap(); + assert_eq!(serialized, json!({"type": "custom-numeric", "value": ".2f"})); + } + + #[test] + fn test_dimension_format_custom_time() { + let json = json!({"type": "custom-time", "value": "%Y-%m-%d %H:%M:%S"}); + let format: DimensionFormat = serde_json::from_value(json).unwrap(); + + // Round-trip + let serialized = serde_json::to_value(&format).unwrap(); + assert_eq!(serialized, json!({"type": "custom-time", "value": "%Y-%m-%d %H:%M:%S"})); + } + + #[test] + fn test_dimension_format_link() { + let json = json!({"type": "link", "label": "Click"}); + let format: DimensionFormat = serde_json::from_value(json).unwrap(); + + // Round-trip + let serialized = serde_json::to_value(&format).unwrap(); + assert_eq!(serialized, json!({"type": "link", "label": "Click"})); + } +} From 8c9c74cfec54d359d8331b69a30eb63980fe6391 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Wed, 25 Mar 2026 16:57:49 +0100 Subject: [PATCH 2/2] chore: fmt --- rust/cubeorchestrator/src/transport.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index f6db688fa64ad..00aa444c52fde 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -334,7 +334,10 @@ mod tests { // Round-trip let serialized = serde_json::to_value(&format).unwrap(); - assert_eq!(serialized, json!({"type": "custom-numeric", "value": ".2f"})); + assert_eq!( + serialized, + json!({"type": "custom-numeric", "value": ".2f"}) + ); } #[test] @@ -344,7 +347,10 @@ mod tests { // Round-trip let serialized = serde_json::to_value(&format).unwrap(); - assert_eq!(serialized, json!({"type": "custom-time", "value": "%Y-%m-%d %H:%M:%S"})); + assert_eq!( + serialized, + json!({"type": "custom-time", "value": "%Y-%m-%d %H:%M:%S"}) + ); } #[test]