Skip to content

Commit

Permalink
fix(graph): add decorators that ref types to graph
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <danscode@selman.org>
  • Loading branch information
dselman committed Sep 20, 2024
1 parent 4e184f3 commit c1d8245
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/codegen/fromcto/odata/odatavisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class ODataVisitor {
default:
argType = 'String';
}
parameters.fileWriter.writeLine(4, `<Annotation Term="${decorator.getName()}${index}" ${argType}="${arg.toString()}" />`);
parameters.fileWriter.writeLine(4, `<Annotation Term="${decorator.getName()}${index}" ${argType}="${typeof arg === 'object' ? arg.name : arg.toString()}" />`);
});
return null;
}
Expand Down
1 change: 0 additions & 1 deletion lib/common/diagramvisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ class DiagramVisitor {
*/
visitScalarField(field, parameters) {
this.visitField(field.getScalarField(), parameters);
field.getDecorators().forEach(decorator => decorator.accept(this, parameters));
}

/**
Expand Down
5 changes: 5 additions & 0 deletions test/codegen/fromcto/data/model/hr.cto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@category(GeneralCategory)
namespace org.acme.hr@1.0.0

import org.acme.hr.base@1.0.0.{Address, State, SSN, Time, EmployeeTShirtSizes, Level, GeneralCategory}
Expand Down Expand Up @@ -43,7 +44,9 @@ concept Company {
o EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers optional
}

@category(GeneralCategory)
enum Department {
@category(GeneralCategory)
o Sales
o Marketing
o Finance
Expand All @@ -57,6 +60,7 @@ abstract asset Equipment identified by serialNumber {
o String serialNumber
}

@test("one")
enum LaptopMake {
o Apple
o Microsoft
Expand Down Expand Up @@ -113,5 +117,6 @@ transaction ChangeOfAddress {
o Address newAddress
}

@category(GeneralCategory)
scalar KinName extends String
scalar KinTelephone extends String
1 change: 1 addition & 0 deletions test/codegen/fromcto/data/model/hr_base.cto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@description("hr base namespace")
namespace org.acme.hr.base@1.0.0

abstract concept Category {}
Expand Down

0 comments on commit c1d8245

Please sign in to comment.