Skip to content

Commit

Permalink
feat(api-gateway): Meta - expose aliasMember for members in View (#8945)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ovr authored Nov 12, 2024
1 parent 3fe838f commit c127f36
Show file tree
Hide file tree
Showing 9 changed files with 447 additions and 50 deletions.
3 changes: 3 additions & 0 deletions packages/cubejs-api-gateway/openspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ components:
type: "string"
type:
type: "string"
aliasMember:
description: "When dimension is defined in View, it keeps the original path: Cube.dimension"
type: "string"
granularities:
type: array
items:
Expand Down
3 changes: 2 additions & 1 deletion packages/cubejs-schema-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"coveragePathIgnorePatterns": [
".*\\.d\\.ts"
],
"globalSetup": "<rootDir>/dist/test/global-setup.js"
"globalSetup": "<rootDir>/dist/test/global-setup.js",
"snapshotResolver": "<rootDir>/test/snapshotResolver.js"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class CubeToMetaTransformer {
? this.isVisible(nameToDimension[1], !nameToDimension[1].primaryKey)
: false,
primaryKey: !!nameToDimension[1].primaryKey,
aliasMember: nameToDimension[1].aliasMember,
granularities:
nameToDimension[1].granularities
? R.compose(R.map((g) => ({
Expand Down
26 changes: 26 additions & 0 deletions packages/cubejs-schema-compiler/test/snapshotResolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const path = require('path');

function resolveSnapshotPath(testPath, snapshotExtension) {
const testSourcePath = testPath.replace('dist/', '');
const testDirectory = path.dirname(testSourcePath);
const testFilename = path.basename(testSourcePath).replace('.js', '.ts');

return `${testDirectory}/__snapshots__/${testFilename}${snapshotExtension}`;
}

function resolveTestPath(snapshotFilePath, snapshotExtension) {
const testSourceFile = snapshotFilePath
.replace('test/unit/__snapshots__', 'dist/test/unit')
.replace('test/integration/__snapshots__', 'dist/test/integration')
.replace('.ts', '.js')
.replace(snapshotExtension, '');

return testSourceFile;
}

module.exports = {
resolveSnapshotPath,
resolveTestPath,

testPathForConsistencyCheck: 'dist/test/unit/Test.spec.js'
};
Loading

0 comments on commit c127f36

Please sign in to comment.