Skip to content

Commit

Permalink
feat(maps): patch concept serialization (#688)
Browse files Browse the repository at this point in the history
Signed-off-by: jonathan.casey <[email protected]>
  • Loading branch information
jonathan-casey authored Aug 17, 2023
1 parent cd38e6f commit 3fa0135
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/concerto-core/lib/serializer/jsongenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class JSONGenerator {
parameters.stack.push(value);
const jsonValue = decl.accept(this, parameters);

value = JSON.stringify(jsonValue);
value = jsonValue;
}

map.set(key, value);
Expand Down
2 changes: 1 addition & 1 deletion packages/concerto-core/lib/serializer/jsonpopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class JSONPopulator {
let subResource = parameters.factory.newConcept(decl.getNamespace(),
decl.getName(), decl.getIdentifierFieldName() );

parameters.jsonStack.push(JSON.parse(value));
parameters.jsonStack.push(value);
parameters.resourceStack.push(subResource);
return decl.accept(this, parameters);
}
Expand Down
24 changes: 12 additions & 12 deletions packages/concerto-core/test/serializer/maptype/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ describe('Serializer', () => {
$class: 'org.acme.sample.Concepts',
rolodex: {
$class: 'org.acme.sample.Rolodex',
'Dublin': '{"$class":"org.acme.sample.Person","name":"Bob"}',
'London': '{"$class":"org.acme.sample.Person","name":"Alice"}'
'Dublin': {'$class':'org.acme.sample.Person','name':'Bob'},
'London': {'$class':'org.acme.sample.Person','name':'Alice'}
}
});

Expand Down Expand Up @@ -514,8 +514,8 @@ describe('Serializer', () => {
$class: 'org.acme.sample.Concepts',
directory: {
$class: 'org.acme.sample.Directory',
'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': '{"$class":"org.acme.sample.Person","name":"Bob"}',
'9FAE34BF-18C3-4770-A6AA-6F7656C356B8': '{"$class":"org.acme.sample.Person","name":"Alice"}',
'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': {'$class':'org.acme.sample.Person','name':'Bob'},
'9FAE34BF-18C3-4770-A6AA-6F7656C356B8': {'$class':'org.acme.sample.Person','name':'Alice'},
}
});

Expand Down Expand Up @@ -805,8 +805,8 @@ describe('Serializer', () => {
$class: 'org.acme.sample.Concepts',
rolodex: {
$class: 'org.acme.sample.Rolodex',
'Dublin': '{"$class":"org.acme.sample.Person","name":"Bob"}',
'London': '{"$class":"org.acme.sample.Person","name":"Alice"}'
'Dublin': {'$class':'org.acme.sample.Person','name':'Bob'},
'London': {'$class':'org.acme.sample.Person','name':'Alice'}
}
};

Expand All @@ -830,8 +830,8 @@ describe('Serializer', () => {
$class: 'org.acme.sample.Concepts',
rolodex: {
$class: 'org.acme.sample.Rolodex',
'Dublin': '{"$class":"org.acme.sample.Person","name":"Bob"}',
'London': '{"$class":"org.acme.sample.Person","name":"Alice"}'
'Dublin': {'$class':'org.acme.sample.Person','name':'Bob'},
'London': {'$class':'org.acme.sample.Person','name':'Alice'}
}
});
});
Expand Down Expand Up @@ -941,8 +941,8 @@ describe('Serializer', () => {
$class: 'org.acme.sample.Concepts',
directory: {
$class: 'org.acme.sample.Directory',
'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': '{"$class":"org.acme.sample.Person","name":"Bob"}',
'9FAE34BF-18C3-4770-A6AA-6F7656C356B8': '{"$class":"org.acme.sample.Person","name":"Alice"}',
'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': {'$class':'org.acme.sample.Person','name':'Bob'},
'9FAE34BF-18C3-4770-A6AA-6F7656C356B8': {'$class':'org.acme.sample.Person','name':'Alice'},
}
};

Expand All @@ -964,8 +964,8 @@ describe('Serializer', () => {
$class: 'org.acme.sample.Concepts',
directory: {
$class: 'org.acme.sample.Directory',
'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': '{"$class":"org.acme.sample.Person","name":"Bob"}',
'9FAE34BF-18C3-4770-A6AA-6F7656C356B8': '{"$class":"org.acme.sample.Person","name":"Alice"}',
'D4F45017-AD2B-416B-AD9F-3B74F7DEA291': {'$class':'org.acme.sample.Person','name':'Bob'},
'9FAE34BF-18C3-4770-A6AA-6F7656C356B8': {'$class':'org.acme.sample.Person','name':'Alice'},
}
});
});
Expand Down

0 comments on commit 3fa0135

Please sign in to comment.