From 6758cf8dc054ddb81304b32aac23cba3f1fe411a Mon Sep 17 00:00:00 2001 From: Sanket Shevkar <43399522+sanketshevkar@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:24:05 +0530 Subject: [PATCH] fix(dcs): enableMapTypes in internal modelmanagers in dcsmanager (#905) Signed-off-by: sanketshevkar --- packages/concerto-core/lib/decoratormanager.js | 5 ++++- packages/concerto-core/test/decoratormanager.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/concerto-core/lib/decoratormanager.js b/packages/concerto-core/lib/decoratormanager.js index 6da75939c..e43a5f74e 100644 --- a/packages/concerto-core/lib/decoratormanager.js +++ b/packages/concerto-core/lib/decoratormanager.js @@ -315,10 +315,12 @@ class DecoratorManager { } if (shouldValidate) { + const enableMapType = modelManager?.enableMapType ? true : false; const validationModelManager = new ModelManager({ strict: true, metamodelValidation: true, addMetamodel: true, + enableMapType }); validationModelManager.addModelFiles(modelManager.getModelFiles()); validationModelManager.addCTOModel( @@ -419,7 +421,8 @@ class DecoratorManager { }); }); - const newModelManager = new ModelManager(); + const enableMapType = modelManager?.enableMapType ? true : false; + const newModelManager = new ModelManager({ enableMapType }); newModelManager.fromAst(decoratedAst); return newModelManager; } diff --git a/packages/concerto-core/test/decoratormanager.js b/packages/concerto-core/test/decoratormanager.js index 28dcad49b..6fbd0780b 100644 --- a/packages/concerto-core/test/decoratormanager.js +++ b/packages/concerto-core/test/decoratormanager.js @@ -302,7 +302,7 @@ describe('DecoratorManager', () => { it('should decorate the specified MapDeclaration', async function() { // load a model to decorate - const testModelManager = new ModelManager({strict:true, skipLocationNodes: true}); + const testModelManager = new ModelManager({strict:true, skipLocationNodes: true, enableMapType: true}); const modelText = fs.readFileSync(path.join(__dirname,'/data/decoratorcommands/test.cto'), 'utf-8'); testModelManager.addCTOModel(modelText, 'test.cto');