Skip to content

Commit 94d5205

Browse files
committed
fix duplicates check for views
1 parent 9a1377e commit 94d5205

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,6 @@ export class CubeSymbols {
183183

184184
protected transform(cubeName: string, errorReporter: ErrorReporter, splitViews: SplitViews) {
185185
const cube = this.getCubeDefinition(cubeName);
186-
const duplicateNames = R.compose(
187-
R.map((nameToDefinitions: any) => nameToDefinitions[0]),
188-
R.toPairs,
189-
R.filter((definitionsByName: any) => definitionsByName.length > 1),
190-
R.groupBy((nameToDefinition: any) => nameToDefinition[0]),
191-
R.unnest,
192-
R.map(R.toPairs),
193-
// @ts-ignore
194-
R.filter((v: any) => !!v)
195-
// @ts-ignore
196-
)([cube.measures, cube.dimensions, cube.segments, cube.preAggregations, cube.hierarchies]);
197-
198-
// @ts-ignore
199-
if (duplicateNames.length > 0) {
200-
// @ts-ignore
201-
errorReporter.error(`${duplicateNames.join(', ')} defined more than once`);
202-
}
203186

204187
camelizeCube(cube);
205188

@@ -218,6 +201,24 @@ export class CubeSymbols {
218201
this.prepareIncludes(cube, errorReporter, splitViews);
219202
}
220203

204+
const duplicateNames = R.compose(
205+
R.map((nameToDefinitions: any) => nameToDefinitions[0]),
206+
R.toPairs,
207+
R.filter((definitionsByName: any) => definitionsByName.length > 1),
208+
R.groupBy((nameToDefinition: any) => nameToDefinition[0]),
209+
R.unnest,
210+
R.map(R.toPairs),
211+
// @ts-ignore
212+
R.filter((v: any) => !!v)
213+
// @ts-ignore
214+
)([cube.measures, cube.dimensions, cube.segments, cube.preAggregations, cube.hierarchies]);
215+
216+
// @ts-ignore
217+
if (duplicateNames.length > 0) {
218+
// @ts-ignore
219+
errorReporter.error(`${duplicateNames.join(', ')} defined more than once`);
220+
}
221+
221222
return Object.assign(
222223
{ cubeName: () => cube.name, cubeObj: () => cube },
223224
cube.measures || {},

0 commit comments

Comments
 (0)