Skip to content

Commit

Permalink
fix(graph): add edge to map relationship between declarations and fields
Browse files Browse the repository at this point in the history
Signed-off-by: muhammed-abdulkadir <[email protected]>
  • Loading branch information
muhammed-abdulkadir committed Oct 29, 2024
1 parent 02644a1 commit d06098b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/common/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class ConcertoGraphVisitor extends DiagramVisitor {
*/
visitScalarField(scalar, parameters) {
super.visitScalarField(scalar, parameters);
parameters.graph.addEdge(scalar.getParent().getFullyQualifiedName(), scalar.getFullyQualifiedName());
parameters.graph.addEdge(parameters.stack.slice(-1), scalar.getFullyQualifiedTypeName());
}

Expand All @@ -278,6 +279,7 @@ class ConcertoGraphVisitor extends DiagramVisitor {
if (!ModelUtil.isPrimitiveType(field.getFullyQualifiedTypeName())) {
parameters.graph.addEdge(parameters.stack.slice(-1), field.getFullyQualifiedTypeName());
}
parameters.graph.addEdge(field.getParent().getFullyQualifiedName(), field.getFullyQualifiedName());
}

/**
Expand Down
74 changes: 74 additions & 0 deletions test/common/__snapshots__/graph.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ exports[`graph #visitor should visit a model manager 1`] = `
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
Expand All @@ -39,55 +44,87 @@ exports[`graph #visitor should visit a model manager 1`] = `
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\`
Expand All @@ -113,7 +150,12 @@ exports[`graph #visitor should visit a model manager and create a dependency gra
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
Expand All @@ -137,53 +179,85 @@ exports[`graph #visitor should visit a model manager and create a dependency gra
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` <--> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
\`[email protected]\` --> \`[email protected]\`
\`[email protected]\`
Expand Down
2 changes: 1 addition & 1 deletion test/common/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('graph', function() {
expect(filteredModelManager.getModelFiles()).toHaveLength(2);
expect(
filteredModelManager.getModelFiles()[0].getAllDeclarations()
).toHaveLength(7);
).toHaveLength(8);

writer.openFile('graph.mmd');
connectedGraph.print(writer);
Expand Down

0 comments on commit d06098b

Please sign in to comment.