Skip to content

Commit c127f36

Browse files
authored
feat(api-gateway): Meta - expose aliasMember for members in View (#8945)
Motivation for change: While working on the new layer for MDX, I discovered that all members in views are defined as View's members. This leads to a problem: I am not able to separate them by cubes to align our model with Analysis Services.
1 parent 3fe838f commit c127f36

File tree

9 files changed

+447
-50
lines changed

9 files changed

+447
-50
lines changed

packages/cubejs-api-gateway/openspec.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ components:
129129
type: "string"
130130
type:
131131
type: "string"
132+
aliasMember:
133+
description: "When dimension is defined in View, it keeps the original path: Cube.dimension"
134+
type: "string"
132135
granularities:
133136
type: array
134137
items:

packages/cubejs-schema-compiler/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"coveragePathIgnorePatterns": [
100100
".*\\.d\\.ts"
101101
],
102-
"globalSetup": "<rootDir>/dist/test/global-setup.js"
102+
"globalSetup": "<rootDir>/dist/test/global-setup.js",
103+
"snapshotResolver": "<rootDir>/test/snapshotResolver.js"
103104
}
104105
}

packages/cubejs-schema-compiler/src/compiler/CubeToMetaTransformer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class CubeToMetaTransformer {
8080
? this.isVisible(nameToDimension[1], !nameToDimension[1].primaryKey)
8181
: false,
8282
primaryKey: !!nameToDimension[1].primaryKey,
83+
aliasMember: nameToDimension[1].aliasMember,
8384
granularities:
8485
nameToDimension[1].granularities
8586
? R.compose(R.map((g) => ({
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const path = require('path');
2+
3+
function resolveSnapshotPath(testPath, snapshotExtension) {
4+
const testSourcePath = testPath.replace('dist/', '');
5+
const testDirectory = path.dirname(testSourcePath);
6+
const testFilename = path.basename(testSourcePath).replace('.js', '.ts');
7+
8+
return `${testDirectory}/__snapshots__/${testFilename}${snapshotExtension}`;
9+
}
10+
11+
function resolveTestPath(snapshotFilePath, snapshotExtension) {
12+
const testSourceFile = snapshotFilePath
13+
.replace('test/unit/__snapshots__', 'dist/test/unit')
14+
.replace('test/integration/__snapshots__', 'dist/test/integration')
15+
.replace('.ts', '.js')
16+
.replace(snapshotExtension, '');
17+
18+
return testSourceFile;
19+
}
20+
21+
module.exports = {
22+
resolveSnapshotPath,
23+
resolveTestPath,
24+
25+
testPathForConsistencyCheck: 'dist/test/unit/Test.spec.js'
26+
};

0 commit comments

Comments
 (0)