Skip to content

Commit

Permalink
test(codegen) update HR model to use multiple namespaces (#68)
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <[email protected]>
  • Loading branch information
dselman authored and jonathan-casey committed Nov 3, 2023
1 parent 92ecc51 commit d1d9411
Show file tree
Hide file tree
Showing 13 changed files with 1,946 additions and 1,162 deletions.
4 changes: 2 additions & 2 deletions lib/codegen/fromcto/csharp/csharpvisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ class CSharpVisitor {
writeField(field, parameters, externalFieldType, isOptional = false) {

// write Map field
if ( Object.keys(field).length > 0 && ModelUtil.isMap?.(field)) {
const decl = field.getModelFile().getAllDeclarations().find(d => d.name === field.ast.type.name);
if (Object.keys(field).length > 0 && ModelUtil.isMap?.(field)) {
const decl = field.getModelFile().getType(field.getType());
parameters.fileWriter.writeLine(1, `public Dictionary<string, ${this.toCSharpType(decl.getValue().getType())}> ${field.getName()} { get; set; }`);
return null;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/codegen/fromcto/typescript/typescriptvisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ class TypescriptVisitor {
const isPrimitive = ModelUtil.isPrimitiveType(mapDeclaration.getValue().getType());

if (isScalar) {
const scalar = mapDeclaration.getModelFile()
.getAllDeclarations()
.find(decl => decl.name === mapDeclaration.getValue().getType());
const scalar = mapDeclaration.getModelFile(mapDeclaration.getValue().getType());
const scalarType = scalar.getType();
valueType = this.toTsType(scalarType, false, false);
} else if (isPrimitive) {
Expand Down
4 changes: 2 additions & 2 deletions lib/common/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ class ConcertoGraphVisitor extends DiagramVisitor {
let valueEdge = mapDeclaration.getValue().getType();

if(!ModelUtil.isPrimitiveType(keyEdge)) {
keyEdge = modelFile.getAllDeclarations().find(d => d.name === mapDeclaration.getKey().getType()).getFullyQualifiedName();
keyEdge = modelFile.getType(mapDeclaration.getKey().getType()).getFullyQualifiedName();
}

if(!ModelUtil.isPrimitiveType(valueEdge)) {
// handle imported types
if (!modelFile.isLocalType(mapDeclaration.getValue().getType())) {
valueEdge = modelFile.resolveImport(mapDeclaration.getValue().getType());
} else {
valueEdge = modelFile.getAllDeclarations().find(d => d.name === mapDeclaration.getValue().getType()).getFullyQualifiedName();
valueEdge = modelFile.getType(mapDeclaration.getValue().getType()).getFullyQualifiedName();
}
}

Expand Down
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"author": "accordproject.org",
"license": "Apache-2.0",
"devDependencies": {
"@accordproject/concerto-cto": "3.14.0",
"@accordproject/concerto-cto": "3.14.2",
"@babel/preset-env": "7.16.11",
"babel-loader": "8.2.3",
"chai": "4.3.6",
Expand All @@ -69,9 +69,9 @@
"webpack-cli": "4.9.1"
},
"dependencies": {
"@accordproject/concerto-core": "3.14.0",
"@accordproject/concerto-util": "3.14.0",
"@accordproject/concerto-vocabulary": "3.14.0",
"@accordproject/concerto-core": "3.14.2",
"@accordproject/concerto-util": "3.14.2",
"@accordproject/concerto-vocabulary": "3.14.2",
"@openapi-contrib/openapi-schema-to-json-schema": "3.2.0",
"ajv": "8.10.0",
"ajv-formats": "2.1.1",
Expand Down
Loading

0 comments on commit d1d9411

Please sign in to comment.