Skip to content

Commit

Permalink
feat(map): remove class reference in Maps (#708)
Browse files Browse the repository at this point in the history
Signed-off-by: jonathan.casey <[email protected]>
  • Loading branch information
jonathan-casey authored Sep 5, 2023
1 parent 9104d55 commit 5da5448
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 122 deletions.
4 changes: 2 additions & 2 deletions packages/concerto-core/lib/serializer/jsongenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ class JSONGenerator {
const obj = parameters.stack.pop();

// initialise Map with $class property
let map = new Map([['$class',obj.get('$class')]]);
let map = new Map();

obj.forEach((value, key) => {

// don't serialize System Properties, other than $class
if(ModelUtil.isSystemProperty(key) && key !== '$class') {
if(ModelUtil.isSystemProperty(key)) {
return;
}

Expand Down
8 changes: 0 additions & 8 deletions packages/concerto-core/lib/serializer/resourcevalidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,6 @@ class ResourceValidator {
throw new Error('Expected a Map, but found ' + JSON.stringify(obj));
}

if (!obj.has('$class')) {
throw new Error('Invalid Map. Map must contain a properly formatted $class property');
}

if (obj.get('$class') !== mapDeclaration.getFullyQualifiedName()) {
throw new Error(`$class value must match ${mapDeclaration.getFullyQualifiedName()}`);
}

obj.forEach((value, key) => {
if (!ModelUtil.isSystemProperty(key)) {
// Validate Key
Expand Down
Loading

0 comments on commit 5da5448

Please sign in to comment.