Skip to content

Commit 608a6fc

Browse files
committed
chore: support link format as object
1 parent fbb85aa commit 608a6fc

File tree

10 files changed

+296
-36
lines changed

10 files changed

+296
-36
lines changed

packages/cubejs-api-gateway/openspec.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,34 @@ components:
273273
enum:
274274
- "percent"
275275
- "currency"
276-
V1CubeMetaDimensionFormat:
276+
V1CubeMetaDimensionSimpleFormat:
277277
type: "string"
278-
description: Format of dimension
278+
description: Simple format of dimension
279279
enum:
280280
- "imageUrl"
281281
- "id"
282282
- "link"
283283
- "percent"
284284
- "currency"
285+
V1CubeMetaDimensionLinkFormat:
286+
type: "object"
287+
description: Link format for dimension with label and type
288+
properties:
289+
label:
290+
type: "string"
291+
description: Label for the link
292+
type:
293+
type: "string"
294+
enum: ["link"]
295+
description: Type of the format (must be 'link')
296+
required:
297+
- label
298+
- type
299+
V1CubeMetaDimensionFormat:
300+
oneOf:
301+
- $ref: "#/components/schemas/V1CubeMetaDimensionSimpleFormat"
302+
- $ref: "#/components/schemas/V1CubeMetaDimensionLinkFormat"
303+
description: Format of dimension - can be either a simple string format or an object with link configuration
285304
V1MetaResponse:
286305
type: "object"
287306
properties:

rust/cubesql/cubeclient/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ src/models/v1_cube_meta.rs
55
src/models/v1_cube_meta_dimension.rs
66
src/models/v1_cube_meta_dimension_format.rs
77
src/models/v1_cube_meta_dimension_granularity.rs
8+
src/models/v1_cube_meta_dimension_link_format.rs
9+
src/models/v1_cube_meta_dimension_simple_format.rs
810
src/models/v1_cube_meta_folder.rs
911
src/models/v1_cube_meta_hierarchy.rs
1012
src/models/v1_cube_meta_join.rs

rust/cubesql/cubeclient/src/models/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ pub mod v1_cube_meta_dimension_format;
66
pub use self::v1_cube_meta_dimension_format::V1CubeMetaDimensionFormat;
77
pub mod v1_cube_meta_dimension_granularity;
88
pub use self::v1_cube_meta_dimension_granularity::V1CubeMetaDimensionGranularity;
9+
pub mod v1_cube_meta_dimension_link_format;
10+
pub use self::v1_cube_meta_dimension_link_format::V1CubeMetaDimensionLinkFormat;
11+
// problem with code-gen, let's rename it as re-export
12+
pub use self::v1_cube_meta_dimension_link_format::Type as V1CubeMetaDimensionLinkFormatType;
13+
pub mod v1_cube_meta_dimension_simple_format;
14+
pub use self::v1_cube_meta_dimension_simple_format::V1CubeMetaDimensionSimpleFormat;
915
pub mod v1_cube_meta_folder;
1016
pub use self::v1_cube_meta_folder::V1CubeMetaFolder;
1117
pub mod v1_cube_meta_hierarchy;
@@ -24,6 +30,8 @@ pub mod v1_cube_meta_type;
2430
pub use self::v1_cube_meta_type::V1CubeMetaType;
2531
pub mod v1_error;
2632
pub use self::v1_error::V1Error;
33+
pub mod v1_load_continue_wait;
34+
pub use self::v1_load_continue_wait::V1LoadContinueWait;
2735
pub mod v1_load_request;
2836
pub use self::v1_load_request::V1LoadRequest;
2937
pub mod v1_load_request_query;
@@ -40,8 +48,8 @@ pub mod v1_load_request_query_join_subquery;
4048
pub use self::v1_load_request_query_join_subquery::V1LoadRequestQueryJoinSubquery;
4149
pub mod v1_load_request_query_time_dimension;
4250
pub use self::v1_load_request_query_time_dimension::V1LoadRequestQueryTimeDimension;
43-
pub mod v1_load_continue_wait;
44-
pub use self::v1_load_continue_wait::V1LoadContinueWait;
51+
pub mod v1_load_request_query_time_dimension_date_range_filter;
52+
pub use self::v1_load_request_query_time_dimension_date_range_filter::V1LoadRequestQueryTimeDimensionDateRangeFilter;
4553
pub mod v1_load_response;
4654
pub use self::v1_load_response::V1LoadResponse;
4755
pub mod v1_load_result;

rust/cubesql/cubeclient/src/models/v1_cube_meta_dimension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct V1CubeMetaDimension {
3131
#[serde(rename = "meta", skip_serializing_if = "Option::is_none")]
3232
pub meta: Option<serde_json::Value>,
3333
#[serde(rename = "format", skip_serializing_if = "Option::is_none")]
34-
pub format: Option<models::V1CubeMetaDimensionFormat>,
34+
pub format: Option<Box<models::V1CubeMetaDimensionFormat>>,
3535
}
3636

3737
impl V1CubeMetaDimension {

rust/cubesql/cubeclient/src/models/v1_cube_meta_dimension_format.rs

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,29 @@
1111
use crate::models;
1212
use serde::{Deserialize, Serialize};
1313

14-
/// V1CubeMetaDimensionFormat : Format of dimension
15-
/// Format of dimension
16-
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
14+
/// V1CubeMetaDimensionFormat : Format of dimension - can be either a simple string format or an object with link configuration
15+
/// Format of dimension - can be either a simple string format or an object with link configuration
16+
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash, PartialOrd, Ord)]
17+
#[serde(untagged)]
1718
pub enum V1CubeMetaDimensionFormat {
18-
#[serde(rename = "imageUrl")]
19-
ImageUrl,
20-
#[serde(rename = "id")]
21-
Id,
22-
#[serde(rename = "link")]
23-
Link,
24-
#[serde(rename = "percent")]
25-
Percent,
26-
#[serde(rename = "currency")]
27-
Currency,
19+
V1CubeMetaDimensionSimpleFormat(models::V1CubeMetaDimensionSimpleFormat),
20+
V1CubeMetaDimensionLinkFormat(Box<models::V1CubeMetaDimensionLinkFormat>),
2821
}
2922

30-
impl std::fmt::Display for V1CubeMetaDimensionFormat {
31-
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32-
match self {
33-
Self::ImageUrl => write!(f, "imageUrl"),
34-
Self::Id => write!(f, "id"),
35-
Self::Link => write!(f, "link"),
36-
Self::Percent => write!(f, "percent"),
37-
Self::Currency => write!(f, "currency"),
38-
}
23+
impl Default for V1CubeMetaDimensionFormat {
24+
fn default() -> Self {
25+
Self::V1CubeMetaDimensionSimpleFormat(Default::default())
3926
}
4027
}
28+
/// Type of the format (must be 'link')
29+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
30+
pub enum Type {
31+
#[serde(rename = "link")]
32+
Link,
33+
}
4134

42-
impl Default for V1CubeMetaDimensionFormat {
43-
fn default() -> V1CubeMetaDimensionFormat {
44-
Self::ImageUrl
35+
impl Default for Type {
36+
fn default() -> Type {
37+
Self::Link
4538
}
4639
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Cube.js
3+
*
4+
* Cube.js Swagger Schema
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
*
8+
* Generated by: https://openapi-generator.tech
9+
*/
10+
11+
use crate::models;
12+
use serde::{Deserialize, Serialize};
13+
14+
/// V1CubeMetaDimensionLinkFormat : Link format for dimension with label and type
15+
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, Eq, Hash, PartialOrd, Ord)]
16+
pub struct V1CubeMetaDimensionLinkFormat {
17+
/// Label for the link
18+
#[serde(rename = "label")]
19+
pub label: String,
20+
/// Type of the format (must be 'link')
21+
#[serde(rename = "type")]
22+
pub r#type: Type,
23+
}
24+
25+
impl V1CubeMetaDimensionLinkFormat {
26+
/// Link format for dimension with label and type
27+
pub fn new(label: String, r#type: Type) -> V1CubeMetaDimensionLinkFormat {
28+
V1CubeMetaDimensionLinkFormat { label, r#type }
29+
}
30+
}
31+
/// Type of the format (must be 'link')
32+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
33+
pub enum Type {
34+
#[serde(rename = "link")]
35+
Link,
36+
}
37+
38+
impl Default for Type {
39+
fn default() -> Type {
40+
Self::Link
41+
}
42+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Cube.js
3+
*
4+
* Cube.js Swagger Schema
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
*
8+
* Generated by: https://openapi-generator.tech
9+
*/
10+
11+
use crate::models;
12+
use serde::{Deserialize, Serialize};
13+
14+
/// V1CubeMetaDimensionSimpleFormat : Simple format of dimension
15+
/// Simple format of dimension
16+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17+
pub enum V1CubeMetaDimensionSimpleFormat {
18+
#[serde(rename = "imageUrl")]
19+
ImageUrl,
20+
#[serde(rename = "id")]
21+
Id,
22+
#[serde(rename = "link")]
23+
Link,
24+
#[serde(rename = "percent")]
25+
Percent,
26+
#[serde(rename = "currency")]
27+
Currency,
28+
}
29+
30+
impl std::fmt::Display for V1CubeMetaDimensionSimpleFormat {
31+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32+
match self {
33+
Self::ImageUrl => write!(f, "imageUrl"),
34+
Self::Id => write!(f, "id"),
35+
Self::Link => write!(f, "link"),
36+
Self::Percent => write!(f, "percent"),
37+
Self::Currency => write!(f, "currency"),
38+
}
39+
}
40+
}
41+
42+
impl Default for V1CubeMetaDimensionSimpleFormat {
43+
fn default() -> V1CubeMetaDimensionSimpleFormat {
44+
Self::ImageUrl
45+
}
46+
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
use serde::{Deserialize, Serialize};
22

33
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4-
pub struct V1LoadRequestQueryTimeDimensionDateRangeFilter {
5-
}
4+
pub struct V1LoadRequestQueryTimeDimensionDateRangeFilter {}
65

76
impl V1LoadRequestQueryTimeDimensionDateRangeFilter {
87
pub fn new() -> V1LoadRequestQueryTimeDimensionDateRangeFilter {
9-
V1LoadRequestQueryTimeDimensionDateRangeFilter {
10-
}
8+
V1LoadRequestQueryTimeDimensionDateRangeFilter {}
119
}
1210
}
13-
14-

0 commit comments

Comments
 (0)