From 5d17aa85bc6c3c9e659b096ecb0d613adfb72fb3 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 30 Jun 2025 16:08:24 +0300 Subject: [PATCH] fix(cubesql): Fix cube rust client schema for custom granularities with sql --- packages/cubejs-api-gateway/openspec.yml | 3 ++- .../src/models/v1_cube_meta_dimension_granularity.rs | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/cubejs-api-gateway/openspec.yml b/packages/cubejs-api-gateway/openspec.yml index a7f7d2dc5de79..d97a857d9d0bd 100644 --- a/packages/cubejs-api-gateway/openspec.yml +++ b/packages/cubejs-api-gateway/openspec.yml @@ -105,7 +105,6 @@ components: required: - name - title - - interval properties: name: type: "string" @@ -113,6 +112,8 @@ components: type: "string" interval: type: "string" + sql: + type: "string" offset: type: "string" origin: diff --git a/rust/cubesql/cubeclient/src/models/v1_cube_meta_dimension_granularity.rs b/rust/cubesql/cubeclient/src/models/v1_cube_meta_dimension_granularity.rs index f3f44c9bc3b8e..c973276f8bcae 100644 --- a/rust/cubesql/cubeclient/src/models/v1_cube_meta_dimension_granularity.rs +++ b/rust/cubesql/cubeclient/src/models/v1_cube_meta_dimension_granularity.rs @@ -14,8 +14,10 @@ pub struct V1CubeMetaDimensionGranularity { pub name: String, #[serde(rename = "title")] pub title: String, - #[serde(rename = "interval")] - pub interval: String, + #[serde(rename = "interval", skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[serde(rename = "sql", skip_serializing_if = "Option::is_none")] + pub sql: Option, #[serde(rename = "offset", skip_serializing_if = "Option::is_none")] pub offset: Option, #[serde(rename = "origin", skip_serializing_if = "Option::is_none")] @@ -23,11 +25,12 @@ pub struct V1CubeMetaDimensionGranularity { } impl V1CubeMetaDimensionGranularity { - pub fn new(name: String, title: String, interval: String) -> V1CubeMetaDimensionGranularity { + pub fn new(name: String, title: String) -> V1CubeMetaDimensionGranularity { V1CubeMetaDimensionGranularity { name, title, - interval, + interval: None, + sql: None, offset: None, origin: None, }