Skip to content

Commit 2f0d63a

Browse files
committed
make YamlCompiler aware of joins as array
1 parent c5a8c32 commit 2f0d63a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class YamlCompiler {
9494
return;
9595
}
9696

97-
const yamlObj = YAML.load(file.content);
97+
const yamlObj: any = YAML.load(file.content);
9898
if (!yamlObj) {
9999
return;
100100
}
@@ -116,7 +116,7 @@ export class YamlCompiler {
116116
}
117117
}
118118

119-
private transpileAndPrepareJsFile(file, methodFn, cubeObj, errorsReport: ErrorReporter) {
119+
private transpileAndPrepareJsFile(file: FileContent, methodFn: ('cube' | 'view'), cubeObj, errorsReport: ErrorReporter): FileContent {
120120
const yamlAst = this.transformYamlCubeObj(cubeObj, errorsReport);
121121

122122
const cubeOrViewCall = t.callExpression(t.identifier(methodFn), [t.stringLiteral(cubeObj.name), yamlAst]);
@@ -135,7 +135,7 @@ export class YamlCompiler {
135135
cubeObj.dimensions = this.yamlArrayToObj(cubeObj.dimensions || [], 'dimension', errorsReport);
136136
cubeObj.segments = this.yamlArrayToObj(cubeObj.segments || [], 'segment', errorsReport);
137137
cubeObj.preAggregations = this.yamlArrayToObj(cubeObj.preAggregations || [], 'preAggregation', errorsReport);
138-
cubeObj.joins = this.yamlArrayToObj(cubeObj.joins || [], 'join', errorsReport);
138+
cubeObj.joins = cubeObj.joins || []; // For edge cases where joins are not defined/null
139139
cubeObj.hierarchies = this.yamlArrayToObj(cubeObj.hierarchies || [], 'hierarchies', errorsReport);
140140

141141
return this.transpileYaml(cubeObj, [], cubeObj.name, errorsReport);

0 commit comments

Comments
 (0)