From e094f867c1ddfb63058344b1ea6fef440f8f29be Mon Sep 17 00:00:00 2001 From: Yannan <73408381+YannanGao-gs@users.noreply.github.com> Date: Tue, 20 Aug 2024 20:08:11 -0400 Subject: [PATCH] fix dataspace composer (#3029) --- .../to/DataSpaceGrammarComposerExtension.java | 4 +++- .../test/TestDataSpaceGrammarRoundtrip.java | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/to/DataSpaceGrammarComposerExtension.java b/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/to/DataSpaceGrammarComposerExtension.java index a40f1c260a8..eb2b79b0b88 100644 --- a/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/to/DataSpaceGrammarComposerExtension.java +++ b/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/to/DataSpaceGrammarComposerExtension.java @@ -150,9 +150,11 @@ else if (executable instanceof DataSpaceTemplateExecutable) private static String renderDataspacePackageableElementExecutable(DataSpacePackageableElementExecutable executable, PureGrammarComposerContext context) { return getTabString(2) + "{\n" + + (executable.id == null ? "" : (getTabString(3) + "id: " + executable.id + ";\n")) + (getTabString(3) + "title: " + convertString(executable.title, true) + ";\n") + (executable.description != null ? (getTabString(3) + "description: " + convertString(executable.description, true) + ";\n") : "") + - getTabString(3) + "executable: " + PureGrammarComposerUtility.convertPath(executable.executable.path) + ";\n" + + getTabString(3) + "executable: " + executable.executable.path + ";\n" + + (executable.executionContextKey != null ? getTabString(3) + "executionContextKey: " + convertString(executable.executionContextKey, true) + ";\n" : "") + getTabString(2) + "}"; } diff --git a/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestDataSpaceGrammarRoundtrip.java b/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestDataSpaceGrammarRoundtrip.java index 01db61b29c2..43c17c483eb 100644 --- a/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestDataSpaceGrammarRoundtrip.java +++ b/legend-engine-xts-data-space/legend-engine-xt-data-space-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestDataSpaceGrammarRoundtrip.java @@ -571,6 +571,14 @@ public void testDataspaceExecutableTemplate() throws JsonProcessingException " \"executable\": { \"path\": \"model::MyExecutable\" }\n" + " },\n" + " {\n" + + " \"_type\": \"dataSpacePackageableElementExecutable\",\n" + + " \"title\": \"Executable 3\",\n" + + " \"id\": \"2\",\n" + + " \"description\": \"description\",\n" + + " \"executable\": { \"path\": \"domain::COVIDData_QueryFunction():TabularDataSet[1]\" },\n" + + " \"executionContextKey\": \"INT\"\n" + + " },\n" + + " {\n" + " \"_type\": \"dataSpaceTemplateExecutable\",\n" + " \"id\": \"1\",\n" + " \"title\": \"Template 1\",\n" + @@ -734,6 +742,13 @@ public void testDataspaceExecutableTemplate() throws JsonProcessingException " executable: model::MyExecutable;\n" + " },\n" + " {\n" + + " id: 2;\n" + + " title: 'Executable 3';\n" + + " description: 'description';\n" + + " executable: domain::COVIDData_QueryFunction():TabularDataSet[1];\n" + + " executionContextKey: 'INT';\n" + + " },\n" + + " {\n" + " id: 1;\n" + " title: 'Template 1';\n" + " description: 'description';\n" +