Skip to content

Commit 5ad92aa

Browse files
authored
chore(schema-compiler): Make YamlCompiler→renderTemplate() public (#9519)
1 parent bcd66bc commit 5ad92aa

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ export class YamlCompiler {
5353
});
5454
}
5555

56+
public async renderTemplate(file: FileContent, compileContext, pythonContext: PythonCtx): Promise<FileContent> {
57+
return {
58+
fileName: file.fileName,
59+
content: await this.getJinjaEngine().renderTemplate(file.fileName, compileContext, {
60+
...pythonContext.functions,
61+
...pythonContext.variables
62+
}),
63+
};
64+
}
65+
5666
public async compileYamlWithJinjaFile(
5767
file: FileContent,
5868
errorsReport: ErrorReporter,
@@ -63,15 +73,9 @@ export class YamlCompiler {
6373
toCompile,
6474
compiledFiles,
6575
compileContext,
66-
pythonContext
76+
pythonContext: PythonCtx
6777
) {
68-
const compiledFile = {
69-
fileName: file.fileName,
70-
content: await this.getJinjaEngine().renderTemplate(file.fileName, compileContext, {
71-
...pythonContext.functions,
72-
...pythonContext.variables
73-
}),
74-
};
78+
const compiledFile = await this.renderTemplate(file, compileContext, pythonContext);
7579

7680
return this.compileYamlFile(
7781
compiledFile,

0 commit comments

Comments
 (0)