Skip to content

Commit

Permalink
fix(cubesql): Add folders to Cube Metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
max-kammerer committed Jan 10, 2025
1 parent d8d8de2 commit 1994dcb
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/cubejs-api-gateway/openspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ components:
type: "string"
meta:
type: "object"
V1CubeMetaFolder:
type: "object"
required:
- name
- members
properties:
name:
type: "string"
members:
type: array
items:
type: "string"
V1CubeMeta:
type: "object"
required:
Expand Down Expand Up @@ -193,6 +205,10 @@ components:
type: "array"
items:
$ref: "#/components/schemas/V1CubeMetaJoin"
folders:
type: "array"
items:
$ref: "#/components/schemas/V1CubeMetaFolder"
V1CubeMetaType:
type: "string"
description: Type of cube
Expand Down
1 change: 1 addition & 0 deletions rust/cubesql/cubeclient/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ src/models/mod.rs
src/models/v1_cube_meta.rs
src/models/v1_cube_meta_dimension.rs
src/models/v1_cube_meta_dimension_granularity.rs
src/models/v1_cube_meta_folder.rs
src/models/v1_cube_meta_join.rs
src/models/v1_cube_meta_measure.rs
src/models/v1_cube_meta_segment.rs
Expand Down
2 changes: 2 additions & 0 deletions rust/cubesql/cubeclient/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pub mod v1_cube_meta_dimension;
pub use self::v1_cube_meta_dimension::V1CubeMetaDimension;
pub mod v1_cube_meta_dimension_granularity;
pub use self::v1_cube_meta_dimension_granularity::V1CubeMetaDimensionGranularity;
pub mod v1_cube_meta_folder;
pub use self::v1_cube_meta_folder::V1CubeMetaFolder;
pub mod v1_cube_meta_join;
pub use self::v1_cube_meta_join::V1CubeMetaJoin;
pub mod v1_cube_meta_measure;
Expand Down
3 changes: 3 additions & 0 deletions rust/cubesql/cubeclient/src/models/v1_cube_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct V1CubeMeta {
pub segments: Vec<crate::models::V1CubeMetaSegment>,
#[serde(rename = "joins", skip_serializing_if = "Option::is_none")]
pub joins: Option<Vec<crate::models::V1CubeMetaJoin>>,
#[serde(rename = "folders", skip_serializing_if = "Option::is_none")]
pub folders: Option<Vec<crate::models::V1CubeMetaFolder>>,
}

impl V1CubeMeta {
Expand All @@ -48,6 +50,7 @@ impl V1CubeMeta {
dimensions,
segments,
joins: None,
folders: None,

Check warning on line 53 in rust/cubesql/cubeclient/src/models/v1_cube_meta.rs

View check run for this annotation

Codecov / codecov/patch

rust/cubesql/cubeclient/src/models/v1_cube_meta.rs#L53

Added line #L53 was not covered by tests
}
}
}
23 changes: 23 additions & 0 deletions rust/cubesql/cubeclient/src/models/v1_cube_meta_folder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Cube.js
*
* Cube.js Swagger Schema
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]

Check warning on line 11 in rust/cubesql/cubeclient/src/models/v1_cube_meta_folder.rs

View check run for this annotation

Codecov / codecov/patch

rust/cubesql/cubeclient/src/models/v1_cube_meta_folder.rs#L11

Added line #L11 was not covered by tests
pub struct V1CubeMetaFolder {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "members")]
pub members: Vec<String>,
}

impl V1CubeMetaFolder {
pub fn new(name: String, members: Vec<String>) -> V1CubeMetaFolder {
V1CubeMetaFolder { name, members }
}

Check warning on line 22 in rust/cubesql/cubeclient/src/models/v1_cube_meta_folder.rs

View check run for this annotation

Codecov / codecov/patch

rust/cubesql/cubeclient/src/models/v1_cube_meta_folder.rs#L20-L22

Added lines #L20 - L22 were not covered by tests
}
1 change: 1 addition & 0 deletions rust/cubesql/cubesql/benches/large_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub fn get_large_model_test_meta(dims: usize) -> Vec<V1CubeMeta> {
.collect(),
segments: vec![],
joins: None,
folders: None,
meta: None,
}]
}
Expand Down
7 changes: 7 additions & 0 deletions rust/cubesql/cubesql/src/compile/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub fn get_test_meta() -> Vec<CubeMeta> {
name: "Logs".to_string(),
relationship: "belongsTo".to_string(),
}]),
folders: None,
meta: None,
},
CubeMeta {
Expand Down Expand Up @@ -199,6 +200,7 @@ pub fn get_test_meta() -> Vec<CubeMeta> {
name: "NumberCube".to_string(),
relationship: "belongsTo".to_string(),
}]),
folders: None,
meta: None,
},
CubeMeta {
Expand All @@ -217,6 +219,7 @@ pub fn get_test_meta() -> Vec<CubeMeta> {
}],
segments: vec![],
joins: None,
folders: None,
meta: None,
},
CubeMeta {
Expand Down Expand Up @@ -288,6 +291,7 @@ pub fn get_test_meta() -> Vec<CubeMeta> {
.collect(),
segments: Vec::new(),
joins: Some(Vec::new()),
folders: None,
meta: None,
},
CubeMeta {
Expand Down Expand Up @@ -396,6 +400,7 @@ pub fn get_test_meta() -> Vec<CubeMeta> {
.collect(),
segments: Vec::new(),
joins: Some(Vec::new()),
folders: None,
meta: None,
},
]
Expand All @@ -418,6 +423,7 @@ pub fn get_string_cube_meta() -> Vec<CubeMeta> {
}],
segments: vec![],
joins: None,
folders: None,
meta: None,
}]
}
Expand Down Expand Up @@ -457,6 +463,7 @@ pub fn get_sixteen_char_member_cube() -> Vec<CubeMeta> {
],
segments: vec![],
joins: None,
folders: None,
meta: None,
}]
}
Expand Down
2 changes: 2 additions & 0 deletions rust/cubesql/cubesql/src/transport/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ mod tests {
measures: vec![],
segments: vec![],
joins: None,
folders: None,
meta: None,
},
CubeMeta {
Expand All @@ -245,6 +246,7 @@ mod tests {
measures: vec![],
segments: vec![],
joins: None,
folders: None,
meta: None,
},
];
Expand Down
1 change: 1 addition & 0 deletions rust/cubesql/cubesql/src/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub type CubeMetaDimension = cubeclient::models::V1CubeMetaDimension;
pub type CubeMetaMeasure = cubeclient::models::V1CubeMetaMeasure;
pub type CubeMetaSegment = cubeclient::models::V1CubeMetaSegment;
pub type CubeMetaJoin = cubeclient::models::V1CubeMetaJoin;
pub type CubeMetaFolder = cubeclient::models::V1CubeMetaFolder;
// Request/Response
pub type TransportLoadResponse = cubeclient::models::V1LoadResponse;
pub type TransportLoadRequestQuery = cubeclient::models::V1LoadRequestQuery;
Expand Down

0 comments on commit 1994dcb

Please sign in to comment.