diff --git a/lib/codegen/fromcto/csharp/csharpvisitor.js b/lib/codegen/fromcto/csharp/csharpvisitor.js index 753544e7..10f40d72 100644 --- a/lib/codegen/fromcto/csharp/csharpvisitor.js +++ b/lib/codegen/fromcto/csharp/csharpvisitor.js @@ -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 ${field.getName()} { get; set; }`); return null; } diff --git a/lib/codegen/fromcto/typescript/typescriptvisitor.js b/lib/codegen/fromcto/typescript/typescriptvisitor.js index 3da9d1c6..fc001537 100644 --- a/lib/codegen/fromcto/typescript/typescriptvisitor.js +++ b/lib/codegen/fromcto/typescript/typescriptvisitor.js @@ -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) { diff --git a/lib/common/graph.js b/lib/common/graph.js index de872197..774f0627 100644 --- a/lib/common/graph.js +++ b/lib/common/graph.js @@ -203,7 +203,7 @@ 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)) { @@ -211,7 +211,7 @@ class ConcertoGraphVisitor extends DiagramVisitor { 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(); } } diff --git a/package-lock.json b/package-lock.json index b71e662d..3f18fcfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "3.16.2", "license": "Apache-2.0", "dependencies": { - "@accordproject/concerto-core": "3.12.3", - "@accordproject/concerto-util": "3.12.3", - "@accordproject/concerto-vocabulary": "3.12.3", + "@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", @@ -22,7 +22,7 @@ "pluralize": "8.0.0" }, "devDependencies": { - "@accordproject/concerto-cto": "3.12.3", + "@accordproject/concerto-cto": "3.14.2", "@babel/preset-env": "7.16.11", "babel-loader": "8.2.3", "chai": "4.3.6", @@ -60,34 +60,62 @@ } }, "node_modules/@accordproject/concerto-core": { - "version": "3.12.3", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-core/-/concerto-core-3.12.3.tgz", - "integrity": "sha512-xFCzM3xwV8Th719sUp4htElqiHWAIwOCqukSaYZ2OxrrXmIBvoj0aWCkGiWYHlMujVegXQrP7R8G+8O+QuGxUg==", - "dependencies": { - "@accordproject/concerto-cto": "3.12.3", - "@accordproject/concerto-metamodel": "3.8.1", - "@accordproject/concerto-util": "3.12.3", - "dayjs": "1.10.8", - "debug": "4.3.1", - "lorem-ipsum": "2.0.3", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-core/-/concerto-core-3.14.2.tgz", + "integrity": "sha512-pnmA8LgPw4lXs//JGlIGJc5zS5bY8B9AyAJTexfcJIrihMZccQVONJ4AQ3/8eL2vh0OgofC65XCx4qrJXXw0Bw==", + "dependencies": { + "@accordproject/concerto-cto": "3.14.2", + "@accordproject/concerto-metamodel": "3.9.0", + "@accordproject/concerto-util": "3.14.2", + "dayjs": "1.11.10", + "debug": "4.3.4", + "lorem-ipsum": "2.0.8", "randexp": "0.5.3", "semver": "7.5.4", "slash": "3.0.0", "urijs": "1.19.11", - "uuid": "8.3.2" + "uuid": "9.0.1" }, "engines": { "node": ">=16", "npm": ">=8" } }, + "node_modules/@accordproject/concerto-core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@accordproject/concerto-core/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@accordproject/concerto-cto": { - "version": "3.12.3", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-cto/-/concerto-cto-3.12.3.tgz", - "integrity": "sha512-iR8IL4/bbCrwoHijCtJVmYa02JygoZI+ODG5TmsYE4Ryl+Rqz4B6oYgISdy1j5ZSDGXSjy2I1bj9K130OtKBbA==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-cto/-/concerto-cto-3.14.2.tgz", + "integrity": "sha512-+gCGQzNKO+kbMAEIsESyOHpcAivOLVUHZU3P34PKMan/stLExLJNIERVWS+BeGvpHu8iQzaA6RiJ6XkjQNhUuA==", "dependencies": { - "@accordproject/concerto-metamodel": "3.8.1", - "@accordproject/concerto-util": "3.12.3", + "@accordproject/concerto-metamodel": "3.9.0", + "@accordproject/concerto-util": "3.14.2", "path-browserify": "1.0.1" }, "engines": { @@ -96,11 +124,12 @@ } }, "node_modules/@accordproject/concerto-metamodel": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-metamodel/-/concerto-metamodel-3.8.1.tgz", - "integrity": "sha512-R0CAtzW/IciPz2BxlEyMgKZtya7sqgZ/YSk5iLD6g16NXsJtj6jytDuSZmNMz0B0FpjtEjSoSXPexCR/aPL1qA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-metamodel/-/concerto-metamodel-3.9.0.tgz", + "integrity": "sha512-SbzLormyTORUZDt46umGZT2aVgOCkH5bo67SjuVRPd5YzywMb/vJfncyd6XCm/vzmUWZ3D9OkPqnnfPvPTRMNg==", "dependencies": { - "@accordproject/concerto-util": "3.9.1" + "@accordproject/concerto-util": "3.9.1", + "@types/node": "20.7.0" }, "engines": { "node": ">=14", @@ -133,14 +162,14 @@ } }, "node_modules/@accordproject/concerto-util": { - "version": "3.12.3", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.12.3.tgz", - "integrity": "sha512-LWgMWwxL54LcpxzirDVKB/rDoyDTgB1q6//3CiGDNm/b91o/t+U3Q1QIVHcDpSYtUCdcyQxq3V+l14QQjmuJfg==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.14.2.tgz", + "integrity": "sha512-TagOBlneJlPXRKi75rWIshnqzQvsmWeXtFU7jwsvuFr2GeP+JeZwj4Clh4L3P8ah3Yu5mu5Z3n+w4M8KLbAxbg==", "dependencies": { "@supercharge/promise-pool": "1.7.0", "axios": "0.23.0", "colors": "1.4.0", - "debug": "4.3.1", + "debug": "4.3.4", "json-colorizer": "2.2.2", "slash": "3.0.0" }, @@ -157,12 +186,28 @@ "follow-redirects": "^1.14.4" } }, + "node_modules/@accordproject/concerto-util/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/@accordproject/concerto-vocabulary": { - "version": "3.12.3", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-vocabulary/-/concerto-vocabulary-3.12.3.tgz", - "integrity": "sha512-UDoa75d6jYPbX511Y5qd+/I87OUBt9eHL7bzpR8rvB6kdevVFVTTH4LiZ2m8QgS+IGnE7MviIxGsiumkx/QCtA==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-vocabulary/-/concerto-vocabulary-3.14.2.tgz", + "integrity": "sha512-cparnUNjstm1IFq96hvG2TzaY5PBPotgH1zoJRxhwng7WDQP6dqatNiGmaF6tkpe0Edmkm/2VbA0CB9aSzavAg==", "dependencies": { - "@accordproject/concerto-metamodel": "3.8.1", + "@accordproject/concerto-metamodel": "3.9.0", "yaml": "2.2.2" }, "engines": { @@ -2546,10 +2591,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.5.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.7.tgz", - "integrity": "sha512-dP7f3LdZIysZnmvP3ANJYTSwg+wLLl8p7RqniVlV7j+oXSXAbt9h0WIBFmJy5inWZoX9wZN6eXx+YXd9Rh3RBA==", - "dev": true + "version": "20.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.7.0.tgz", + "integrity": "sha512-zI22/pJW2wUZOVyguFaUL1HABdmSVxpXrzIqkjsHmyUjNhPoWM1CKfvVuXfetHhIok4RY573cqS0mZ1SJEnoTg==" }, "node_modules/@types/stack-utils": { "version": "2.0.1", @@ -3440,7 +3484,8 @@ "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true }, "node_modules/commondir": { "version": "1.0.1", @@ -3488,9 +3533,9 @@ } }, "node_modules/dayjs": { - "version": "1.10.8", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.8.tgz", - "integrity": "sha512-wbNwDfBHHur9UOzNUjeKUOJ0fCb0a52Wx0xInmQ7Y8FstyajiV1NmK1e00cxsr9YrE9r7yAChE0VvpuY5Rnlow==" + "version": "1.11.10", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", + "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" }, "node_modules/debug": { "version": "4.3.1", @@ -5789,11 +5834,11 @@ } }, "node_modules/lorem-ipsum": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/lorem-ipsum/-/lorem-ipsum-2.0.3.tgz", - "integrity": "sha512-CX2r84DMWjW/DWiuzicTI9aRaJPAw2cvAGMJYZh/nx12OkTGqloj8y8FU0S8ZkKwOdqhfxEA6Ly8CW2P6Yxjwg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/lorem-ipsum/-/lorem-ipsum-2.0.8.tgz", + "integrity": "sha512-5RIwHuCb979RASgCJH0VKERn9cQo/+NcAi2BMe9ddj+gp7hujl6BI+qdOG4nVsLDpwWEJwTVYXNKP6BGgbcoGA==", "dependencies": { - "commander": "^2.17.1" + "commander": "^9.3.0" }, "bin": { "lorem-ipsum": "dist/bin/lorem-ipsum.bin.js" @@ -5803,6 +5848,14 @@ "npm": ">= 5.x" } }, + "node_modules/lorem-ipsum/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -8026,6 +8079,7 @@ "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, "bin": { "uuid": "dist/bin/uuid" } diff --git a/package.json b/package.json index 8c57e8db..72518b54 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "author": "accordproject.org", "license": "Apache-2.0", "devDependencies": { - "@accordproject/concerto-cto": "3.12.3", + "@accordproject/concerto-cto": "3.14.2", "@babel/preset-env": "7.16.11", "babel-loader": "8.2.3", "chai": "4.3.6", @@ -69,9 +69,9 @@ "webpack-cli": "4.9.1" }, "dependencies": { - "@accordproject/concerto-core": "3.12.3", - "@accordproject/concerto-util": "3.12.3", - "@accordproject/concerto-vocabulary": "3.12.3", + "@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", diff --git a/test/codegen/__snapshots__/codegen.js.snap b/test/codegen/__snapshots__/codegen.js.snap index 08e15db8..d0f07d5e 100644 --- a/test/codegen/__snapshots__/codegen.js.snap +++ b/test/codegen/__snapshots__/codegen.js.snap @@ -64,8 +64,8 @@ protocol MyProtocol { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'avro' 3`] = ` { - "key": "org.acme.hr.avdl", - "value": "@namespace("org.acme.hr") + "key": "org.acme.hr.base.avdl", + "value": "@namespace("org.acme.hr.base") protocol MyProtocol { import idl "concerto@1.0.0.avdl"; @@ -79,23 +79,42 @@ protocol MyProtocol { CA } + enum TShirtSizeType { + SMALL, + MEDIUM, + LARGE + } + record Address { string street; string city; union { null, State } state; string zipCode; string country; - Map1 dictionary1; - Map2 dictionary2; - Map3 dictionary3; - Map4 dictionary4; - Map5 dictionary5; - Map6 dictionary6; } +} +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'avro' 4`] = ` +{ + "key": "org.acme.hr.avdl", + "value": "@namespace("org.acme.hr") +protocol MyProtocol { + + import idl "org.acme.hr.base.avdl"; + import idl "concerto@1.0.0.avdl"; + record Company { string name; Address headquarters; + union { null, CompanyProperties } companyProperties; + union { null, EmployeeDirectory } employeeDirectory; + union { null, EmployeeTShirtSizes } employeeTShirtSizes; + union { null, EmployeeProfiles } employeeProfiles; + union { null, EmployeeSocialSecurityNumbers } employeeSocialSecurityNumbers; } enum Department { @@ -131,6 +150,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record Employee { @@ -151,6 +171,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record Contractor { @@ -165,6 +186,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record Manager { @@ -186,6 +208,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record CompanyEvent { @@ -305,8 +328,8 @@ public abstract class Event : Concept { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'csharp' 3`] = ` { - "key": "org.acme.hr.cs", - "value": "namespace org.acme.hr; + "key": "org.acme.hr.base.cs", + "value": "namespace org.acme.hr.base; using AccordProject.Concerto; [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public enum State { @@ -317,32 +340,49 @@ public enum State { IL, CA, } -[AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = null, Name = "Address")] +[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] +public enum TShirtSizeType { + SMALL, + MEDIUM, + LARGE, +} +[AccordProject.Concerto.Type(Namespace = "org.acme.hr.base", Version = null, Name = "Address")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] public class Address : Concept { [System.Text.Json.Serialization.JsonPropertyName("$class")] - public override string _class { get; } = "org.acme.hr.Address"; + public override string _class { get; } = "org.acme.hr.base.Address"; public string street { get; set; } public string city { get; set; } public State? state { get; set; } public string zipCode { get; set; } public string country { get; set; } - public Dictionary dictionary1 { get; set; } - public Dictionary dictionary2 { get; set; } - public Dictionary dictionary3 { get; set; } - public Dictionary dictionary4 { get; set; } - public Dictionary dictionary5 { get; set; } - public Dictionary dictionary6 { get; set; } } //Dummy implementation of the scalar declaration to avoid compilation errors. class Time_Dummy {} +//Dummy implementation of the scalar declaration to avoid compilation errors. +class SSN_Dummy {} +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'csharp' 4`] = ` +{ + "key": "org.acme.hr.cs", + "value": "namespace org.acme.hr; +using org.acme.hr.base; +using AccordProject.Concerto; [AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = null, Name = "Company")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] public class Company : Concept { [System.Text.Json.Serialization.JsonPropertyName("$class")] public override string _class { get; } = "org.acme.hr.Company"; public string name { get; set; } - public Address headquarters { get; set; } + public org.acme.hr.base.Address headquarters { get; set; } + public Dictionary companyProperties { get; set; } + public Dictionary employeeDirectory { get; set; } + public Dictionary employeeTShirtSizes { get; set; } + public Dictionary employeeProfiles { get; set; } + public Dictionary employeeSocialSecurityNumbers { get; set; } } [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public enum Department { @@ -373,8 +413,6 @@ public class Laptop : Equipment { public override string _class { get; } = "org.acme.hr.Laptop"; public LaptopMake make { get; set; } } -//Dummy implementation of the scalar declaration to avoid compilation errors. -class SSN_Dummy {} [AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = null, Name = "Person")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] public abstract class Person : Participant { @@ -385,11 +423,12 @@ public abstract class Person : Participant { public string firstName { get; set; } public string lastName { get; set; } public string? middleNames { get; set; } - public Address homeAddress { get; set; } + public org.acme.hr.base.Address homeAddress { get; set; } [System.ComponentModel.DataAnnotations.RegularExpression(@"\\d{3}-\\d{2}-\\{4}+", ErrorMessage = "Invalid characters")] public string ssn { get; set; } public float height { get; set; } public System.DateTime dob { get; set; } + public Dictionary nextOfKin { get; set; } } [AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = null, Name = "Employee")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] @@ -401,7 +440,7 @@ public class Employee : Person { public int numDependents { get; set; } public bool retired { get; set; } public Department department { get; set; } - public Address officeAddress { get; set; } + public org.acme.hr.base.Address officeAddress { get; set; } public Equipment[] companyAssets { get; set; } public Manager manager { get; set; } } @@ -439,8 +478,12 @@ public class ChangeOfAddress : Transaction { [System.Text.Json.Serialization.JsonPropertyName("$class")] public override string _class { get; } = "org.acme.hr.ChangeOfAddress"; public Person Person { get; set; } - public Address newAddress { get; set; } + public org.acme.hr.base.Address newAddress { get; set; } } +//Dummy implementation of the scalar declaration to avoid compilation errors. +class KinName_Dummy {} +//Dummy implementation of the scalar declaration to avoid compilation errors. +class KinTelephone_Dummy {} ", } `; @@ -502,10 +545,9 @@ type Event struct { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'golang' 3`] = ` { - "key": "org.acme.hr.go", - "value": "// Package org_acme_hr contains domain objects and was generated from Concerto namespace org.acme.hr. -package org_acme_hr -import "time" + "key": "org.acme.hr.base.go", + "value": "// Package org_acme_hr_base contains domain objects and was generated from Concerto namespace org.acme.hr.base. +package org_acme_hr_base import "concerto_1_0_0"; type State int @@ -517,6 +559,12 @@ const ( IL CA ) +type TShirtSizeType int +const ( + SMALL TShirtSizeType = 1 + iota + MEDIUM + LARGE +) type Address struct { concerto_1_0_0.Concept Street string \`json:"street"\` @@ -524,17 +572,29 @@ type Address struct { State State \`json:"state"\` ZipCode string \`json:"zipCode"\` Country string \`json:"country"\` - Dictionary1 Map1 \`json:"dictionary1"\` - Dictionary2 Map2 \`json:"dictionary2"\` - Dictionary3 Map3 \`json:"dictionary3"\` - Dictionary4 Map4 \`json:"dictionary4"\` - Dictionary5 Map5 \`json:"dictionary5"\` - Dictionary6 Map6 \`json:"dictionary6"\` } +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'golang' 4`] = ` +{ + "key": "org.acme.hr.go", + "value": "// Package org_acme_hr contains domain objects and was generated from Concerto namespace org.acme.hr. +package org_acme_hr +import "time" +import "org_acme_hr_base"; +import "concerto_1_0_0"; + type Company struct { concerto_1_0_0.Concept Name string \`json:"name"\` Headquarters Address \`json:"headquarters"\` + CompanyProperties CompanyProperties \`json:"companyProperties"\` + EmployeeDirectory EmployeeDirectory \`json:"employeeDirectory"\` + EmployeeTShirtSizes EmployeeTShirtSizes \`json:"employeeTShirtSizes"\` + EmployeeProfiles EmployeeProfiles \`json:"employeeProfiles"\` + EmployeeSocialSecurityNumbers EmployeeSocialSecurityNumbers \`json:"employeeSocialSecurityNumbers"\` } type Department int const ( @@ -568,6 +628,7 @@ type Person struct { Ssn string \`json:"ssn"\` Height float64 \`json:"height"\` Dob time.Time \`json:"dob"\` + NextOfKin NextOfKin \`json:"nextOfKin"\` } type Employee struct { Person @@ -610,7 +671,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "key": "model.gql", "value": "directive @resource on OBJECT | FIELD_DEFINITION scalar DateTime -# namespace org.acme.hr +# namespace org.acme.hr.base enum State { MA NY @@ -619,46 +680,55 @@ enum State { IL CA } +enum TShirtSizeType { + SMALL + MEDIUM + LARGE +} +type EmployeeTShirtSizes { + key: SSN + value: TShirtSizeType +} type Address { street: String! city: String! state: State zipCode: String! country: String! - dictionary1: Map1! - dictionary2: Map2! - dictionary3: Map3! - dictionary4: Map4! - dictionary5: Map5! - dictionary6: Map6! -} -type Map1 { +} +# namespace org.acme.hr +type CompanyProperties { key: String value: String } -type Map2 { +type EmployeeLoginTimes { key: String - value: DateTime + value: Time } -type Map3 { +type EmployeeSocialSecurityNumbers { key: String value: SSN } -type Map4 { +type NextOfKin { + key: KinName + value: KinTelephone +} +type EmployeeProfiles { key: String value: Concept } -type Map5 { - key: SSN - value: String -} -type Map6 { +type EmployeeDirectory { key: SSN value: Employee } type Company { name: String! headquarters: Address! + companyProperties: CompanyProperties + employeeDirectory: EmployeeDirectory + employeeTShirtSizes: EmployeeTShirtSizes + employeeProfiles: EmployeeProfiles + employeeSocialSecurityNumbers: EmployeeSocialSecurityNumbers } enum Department { Sales @@ -690,6 +760,7 @@ type Person @resource { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type Employee { @@ -709,6 +780,7 @@ type Employee { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type Contractor { @@ -722,6 +794,7 @@ type Contractor { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type Manager { @@ -742,6 +815,7 @@ type Manager { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type CompanyEvent { @@ -885,9 +959,9 @@ public abstract class Event extends Concept { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 6`] = ` { - "key": "org/acme/hr/State.java", + "key": "org/acme/hr/base/State.java", "value": "// this code is generated and should not be modified -package org.acme.hr; +package org.acme.hr.base; import com.fasterxml.jackson.annotation.*; @JsonIgnoreProperties({"$class"}) @@ -905,9 +979,26 @@ public enum State { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 7`] = ` { - "key": "org/acme/hr/Address.java", + "key": "org/acme/hr/base/TShirtSizeType.java", "value": "// this code is generated and should not be modified -package org.acme.hr; +package org.acme.hr.base; + +import com.fasterxml.jackson.annotation.*; +@JsonIgnoreProperties({"$class"}) +public enum TShirtSizeType { + SMALL, + MEDIUM, + LARGE, +} +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 8`] = ` +{ + "key": "org/acme/hr/base/Address.java", + "value": "// this code is generated and should not be modified +package org.acme.hr.base; import concerto.Concept; import concerto.Asset; @@ -923,12 +1014,6 @@ public class Address extends Concept { private State state; private String zipCode; private String country; - private Map1 dictionary1; - private Map2 dictionary2; - private Map3 dictionary3; - private Map4 dictionary4; - private Map5 dictionary5; - private Map6 dictionary6; public String getStreet() { return this.street; } @@ -944,24 +1029,6 @@ public class Address extends Concept { public String getCountry() { return this.country; } - public Map1 getDictionary1() { - return this.dictionary1; - } - public Map2 getDictionary2() { - return this.dictionary2; - } - public Map3 getDictionary3() { - return this.dictionary3; - } - public Map4 getDictionary4() { - return this.dictionary4; - } - public Map5 getDictionary5() { - return this.dictionary5; - } - public Map6 getDictionary6() { - return this.dictionary6; - } public void setStreet(String street) { this.street = street; } @@ -977,35 +1044,22 @@ public class Address extends Concept { public void setCountry(String country) { this.country = country; } - public void setDictionary1(Map1 dictionary1) { - this.dictionary1 = dictionary1; - } - public void setDictionary2(Map2 dictionary2) { - this.dictionary2 = dictionary2; - } - public void setDictionary3(Map3 dictionary3) { - this.dictionary3 = dictionary3; - } - public void setDictionary4(Map4 dictionary4) { - this.dictionary4 = dictionary4; - } - public void setDictionary5(Map5 dictionary5) { - this.dictionary5 = dictionary5; - } - public void setDictionary6(Map6 dictionary6) { - this.dictionary6 = dictionary6; - } } ", } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 8`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 9`] = ` { "key": "org/acme/hr/Company.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1017,24 +1071,59 @@ import com.fasterxml.jackson.annotation.*; public class Company extends Concept { private String name; private Address headquarters; + private CompanyProperties companyProperties; + private EmployeeDirectory employeeDirectory; + private EmployeeTShirtSizes employeeTShirtSizes; + private EmployeeProfiles employeeProfiles; + private EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers; public String getName() { return this.name; } public Address getHeadquarters() { return this.headquarters; } + public CompanyProperties getCompanyProperties() { + return this.companyProperties; + } + public EmployeeDirectory getEmployeeDirectory() { + return this.employeeDirectory; + } + public EmployeeTShirtSizes getEmployeeTShirtSizes() { + return this.employeeTShirtSizes; + } + public EmployeeProfiles getEmployeeProfiles() { + return this.employeeProfiles; + } + public EmployeeSocialSecurityNumbers getEmployeeSocialSecurityNumbers() { + return this.employeeSocialSecurityNumbers; + } public void setName(String name) { this.name = name; } public void setHeadquarters(Address headquarters) { this.headquarters = headquarters; } + public void setCompanyProperties(CompanyProperties companyProperties) { + this.companyProperties = companyProperties; + } + public void setEmployeeDirectory(EmployeeDirectory employeeDirectory) { + this.employeeDirectory = employeeDirectory; + } + public void setEmployeeTShirtSizes(EmployeeTShirtSizes employeeTShirtSizes) { + this.employeeTShirtSizes = employeeTShirtSizes; + } + public void setEmployeeProfiles(EmployeeProfiles employeeProfiles) { + this.employeeProfiles = employeeProfiles; + } + public void setEmployeeSocialSecurityNumbers(EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers) { + this.employeeSocialSecurityNumbers = employeeSocialSecurityNumbers; + } } ", } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 9`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 10`] = ` { "key": "org/acme/hr/Department.java", "value": "// this code is generated and should not be modified @@ -1054,12 +1143,17 @@ public enum Department { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 10`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 11`] = ` { "key": "org/acme/hr/Equipment.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1088,7 +1182,7 @@ public abstract class Equipment extends Asset { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 11`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 12`] = ` { "key": "org/acme/hr/LaptopMake.java", "value": "// this code is generated and should not be modified @@ -1104,12 +1198,17 @@ public enum LaptopMake { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 12`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 13`] = ` { "key": "org/acme/hr/Laptop.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1138,12 +1237,17 @@ public class Laptop extends Equipment { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 13`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 14`] = ` { "key": "org/acme/hr/Person.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1168,6 +1272,7 @@ public abstract class Person extends Participant { private String ssn; private double height; private java.util.Date dob; + private NextOfKin nextOfKin; public String getEmail() { return this.email; } @@ -1192,6 +1297,9 @@ public abstract class Person extends Participant { public java.util.Date getDob() { return this.dob; } + public NextOfKin getNextOfKin() { + return this.nextOfKin; + } public void setEmail(String email) { this.email = email; } @@ -1216,17 +1324,25 @@ public abstract class Person extends Participant { public void setDob(java.util.Date dob) { this.dob = dob; } + public void setNextOfKin(NextOfKin nextOfKin) { + this.nextOfKin = nextOfKin; + } } ", } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 14`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 15`] = ` { "key": "org/acme/hr/Employee.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1304,12 +1420,17 @@ public class Employee extends Person { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 15`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 16`] = ` { "key": "org/acme/hr/Contractor.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1345,12 +1466,17 @@ public class Contractor extends Person { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 16`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 17`] = ` { "key": "org/acme/hr/Manager.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1379,12 +1505,17 @@ public class Manager extends Employee { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 17`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 18`] = ` { "key": "org/acme/hr/CompanyEvent.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1398,12 +1529,17 @@ public class CompanyEvent extends Event { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 18`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 19`] = ` { "key": "org/acme/hr/Onboarded.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1424,12 +1560,17 @@ public class Onboarded extends CompanyEvent { } `; -exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 19`] = ` +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'java' 20`] = ` { "key": "org/acme/hr/ChangeOfAddress.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -1463,9 +1604,9 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "value": "{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "org.acme.hr.State": { + "org.acme.hr.base.State": { "title": "State", - "description": "An instance of org.acme.hr.State", + "description": "An instance of org.acme.hr.base.State", "enum": [ "MA", "NY", @@ -1475,16 +1616,25 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "CA" ] }, - "org.acme.hr.Address": { + "org.acme.hr.base.TShirtSizeType": { + "title": "TShirtSizeType", + "description": "An instance of org.acme.hr.base.TShirtSizeType", + "enum": [ + "SMALL", + "MEDIUM", + "LARGE" + ] + }, + "org.acme.hr.base.Address": { "title": "Address", - "description": "An instance of org.acme.hr.Address", + "description": "An instance of org.acme.hr.base.Address", "type": "object", "properties": { "$class": { "type": "string", - "default": "org.acme.hr.Address", - "pattern": "^org\\\\.acme\\\\.hr\\\\.Address$", - "description": "The class identifier for org.acme.hr.Address" + "default": "org.acme.hr.base.Address", + "pattern": "^org\\\\.acme\\\\.hr\\\\.base\\\\.Address$", + "description": "The class identifier for org.acme.hr.base.Address" }, "street": { "type": "string" @@ -1493,7 +1643,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "state": { - "$ref": "#/definitions/org.acme.hr.State" + "$ref": "#/definitions/org.acme.hr.base.State" }, "zipCode": { "type": "string" @@ -1507,19 +1657,17 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "street", "city", "zipCode", - "country", - "dictionary1", - "dictionary2", - "dictionary3", - "dictionary4", - "dictionary5", - "dictionary6" + "country" ] }, - "org.acme.hr.Time": { + "org.acme.hr.base.Time": { "format": "date-time", "type": "string" }, + "org.acme.hr.base.SSN": { + "type": "string", + "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" + }, "org.acme.hr.Company": { "title": "Company", "description": "An instance of org.acme.hr.Company", @@ -1535,7 +1683,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "headquarters": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" } }, "required": [ @@ -1613,10 +1761,6 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "serialNumber" ] }, - "org.acme.hr.SSN": { - "type": "string", - "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" - }, "org.acme.hr.Person": { "title": "Person", "description": "An instance of org.acme.hr.Person", @@ -1642,7 +1786,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -1665,7 +1809,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ], "$decorators": { "resource": [] @@ -1698,7 +1843,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "$ref": "#/definitions/org.acme.hr.Department" }, "officeAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" }, "companyAssets": { "type": "array", @@ -1731,7 +1876,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -1761,7 +1906,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr.Contractor": { @@ -1796,7 +1942,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -1820,7 +1966,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr.Manager": { @@ -1857,7 +2004,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "$ref": "#/definitions/org.acme.hr.Department" }, "officeAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" }, "companyAssets": { "type": "array", @@ -1890,7 +2037,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -1920,7 +2067,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr.CompanyEvent": { @@ -1976,7 +2124,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "description": "The identifier of an instance of org.acme.hr.Person" }, "newAddress": { - "$ref": "#/definitions/org.acme.hr.Address" + "$ref": "#/definitions/org.acme.hr.base.Address" } }, "required": [ @@ -1984,6 +2132,13 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "Person", "newAddress" ] + }, + "org.acme.hr.KinName": { + "type": "string" + }, + "org.acme.hr.KinTelephone": { + "format": "date-time", + "type": "string" } } } @@ -1994,16 +2149,16 @@ exports[`codegen #formats check we can convert all formats from namespace unvers exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'markdown' 1`] = ` { "key": "models.md", - "value": "# Namespace org.acme.hr + "value": "# Namespace org.acme.hr.base ## Overview -- 2 concepts -- 3 enumerations -- 2 assets -- 4 participants -- 1 transactions -- 2 events -- 22 total declarations +- 1 concepts +- 2 enumerations +- 0 assets +- 0 participants +- 0 transactions +- 0 events +- 6 total declarations ## Imports - concerto@1.0.0.Concept @@ -2015,7 +2170,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers ## Diagram \`\`\`mermaid classDiagram -class \`org.acme.hr.State\` { +class \`org.acme.hr.base.State\` { << enumeration>> + \`MA\` + \`NY\` @@ -2025,35 +2180,68 @@ class \`org.acme.hr.State\` { + \`CA\` } -class \`org.acme.hr.Address\` { +class \`org.acme.hr.base.TShirtSizeType\` { +<< enumeration>> + + \`SMALL\` + + \`MEDIUM\` + + \`LARGE\` +} + +class \`org.acme.hr.base.Address\` { << concept>> + \`String\` \`street\` + \`String\` \`city\` + \`State\` \`state\` + \`String\` \`zipCode\` + \`String\` \`country\` - + \`Map1\` \`dictionary1\` - + \`Map2\` \`dictionary2\` - + \`Map3\` \`dictionary3\` - + \`Map4\` \`dictionary4\` - + \`Map5\` \`dictionary5\` - + \`Map6\` \`dictionary6\` -} - -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.State\` -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.Map1\` -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.Map2\` -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.Map3\` -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.Map4\` -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.Map5\` -\`org.acme.hr.Address\` "1" *-- "1" \`org.acme.hr.Map6\` +} + +\`org.acme.hr.base.Address\` "1" *-- "1" \`org.acme.hr.base.State\` +\`\`\` + +# Namespace org.acme.hr + +## Overview +- 1 concepts +- 2 enumerations +- 2 assets +- 4 participants +- 1 transactions +- 2 events +- 20 total declarations + +## Imports +- org.acme.hr.base.Address +- org.acme.hr.base.State +- org.acme.hr.base.SSN +- org.acme.hr.base.Time +- org.acme.hr.base.EmployeeTShirtSizes +- concerto@1.0.0.Concept +- concerto@1.0.0.Asset +- concerto@1.0.0.Transaction +- concerto@1.0.0.Participant +- concerto@1.0.0.Event + +## Diagram +\`\`\`mermaid +classDiagram class \`org.acme.hr.Company\` { << concept>> + \`String\` \`name\` + \`Address\` \`headquarters\` -} - -\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.Address\` + + \`CompanyProperties\` \`companyProperties\` + + \`EmployeeDirectory\` \`employeeDirectory\` + + \`EmployeeTShirtSizes\` \`employeeTShirtSizes\` + + \`EmployeeProfiles\` \`employeeProfiles\` + + \`EmployeeSocialSecurityNumbers\` \`employeeSocialSecurityNumbers\` +} + +\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.base.Address\` +\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.CompanyProperties\` +\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.EmployeeDirectory\` +\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.base.EmployeeTShirtSizes\` +\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.EmployeeProfiles\` +\`org.acme.hr.Company\` "1" *-- "1" \`org.acme.hr.EmployeeSocialSecurityNumbers\` class \`org.acme.hr.Department\` { << enumeration>> + \`Sales\` @@ -2092,10 +2280,12 @@ class \`org.acme.hr.Person\` { + \`String\` \`ssn\` + \`Double\` \`height\` + \`DateTime\` \`dob\` + + \`NextOfKin\` \`nextOfKin\` } -\`org.acme.hr.Person\` "1" *-- "1" \`org.acme.hr.Address\` -\`org.acme.hr.Person\` "1" *-- "1" \`org.acme.hr.SSN\` +\`org.acme.hr.Person\` "1" *-- "1" \`org.acme.hr.base.Address\` +\`org.acme.hr.Person\` "1" *-- "1" \`org.acme.hr.base.SSN\` +\`org.acme.hr.Person\` "1" *-- "1" \`org.acme.hr.NextOfKin\` class \`org.acme.hr.Employee\` { << participant>> + \`String\` \`employeeId\` @@ -2109,7 +2299,7 @@ class \`org.acme.hr.Employee\` { } \`org.acme.hr.Employee\` "1" *-- "1" \`org.acme.hr.Department\` -\`org.acme.hr.Employee\` "1" *-- "1" \`org.acme.hr.Address\` +\`org.acme.hr.Employee\` "1" *-- "1" \`org.acme.hr.base.Address\` \`org.acme.hr.Employee\` "1" *-- "*" \`org.acme.hr.Equipment\` \`org.acme.hr.Employee\` "1" o-- "1" \`org.acme.hr.Manager\` : manager \`org.acme.hr.Employee\` --|> \`org.acme.hr.Person\` @@ -2146,7 +2336,7 @@ class \`org.acme.hr.ChangeOfAddress\` { } \`org.acme.hr.ChangeOfAddress\` "1" o-- "1" \`org.acme.hr.Person\` : Person -\`org.acme.hr.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr.Address\` +\`org.acme.hr.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr.base.Address\` \`\`\` ", @@ -2157,7 +2347,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers { "key": "model.mmd", "value": "classDiagram -class \`org.acme.hr.State\` { +class \`org.acme.hr.base.State\` { << enumeration>> + \`MA\` + \`NY\` @@ -2167,27 +2357,34 @@ class \`org.acme.hr.State\` { + \`CA\` } -\`org.acme.hr.State\` --|> \`concerto@1.0.0.Concept\` -class \`org.acme.hr.Address\` { +\`org.acme.hr.base.State\` --|> \`concerto@1.0.0.Concept\` +class \`org.acme.hr.base.TShirtSizeType\` { +<< enumeration>> + + \`SMALL\` + + \`MEDIUM\` + + \`LARGE\` +} + +\`org.acme.hr.base.TShirtSizeType\` --|> \`concerto@1.0.0.Concept\` +class \`org.acme.hr.base.Address\` { << concept>> + \`String\` \`street\` + \`String\` \`city\` + \`State\` \`state\` + \`String\` \`zipCode\` + \`String\` \`country\` - + \`Map1\` \`dictionary1\` - + \`Map2\` \`dictionary2\` - + \`Map3\` \`dictionary3\` - + \`Map4\` \`dictionary4\` - + \`Map5\` \`dictionary5\` - + \`Map6\` \`dictionary6\` } -\`org.acme.hr.Address\` --|> \`concerto@1.0.0.Concept\` +\`org.acme.hr.base.Address\` --|> \`concerto@1.0.0.Concept\` class \`org.acme.hr.Company\` { << concept>> + \`String\` \`name\` + \`Address\` \`headquarters\` + + \`CompanyProperties\` \`companyProperties\` + + \`EmployeeDirectory\` \`employeeDirectory\` + + \`EmployeeTShirtSizes\` \`employeeTShirtSizes\` + + \`EmployeeProfiles\` \`employeeProfiles\` + + \`EmployeeSocialSecurityNumbers\` \`employeeSocialSecurityNumbers\` } \`org.acme.hr.Company\` --|> \`concerto@1.0.0.Concept\` @@ -2231,6 +2428,7 @@ class \`org.acme.hr.Person\` { + \`String\` \`ssn\` + \`Double\` \`height\` + \`DateTime\` \`dob\` + + \`NextOfKin\` \`nextOfKin\` } \`org.acme.hr.Person\` --|> \`concerto@1.0.0.Participant\` @@ -2321,7 +2519,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'odata' 2`] = ` { - "key": "org.acme.hr.csdl", + "key": "org.acme.hr.base.csdl", "value": " @@ -2331,7 +2529,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers - + @@ -2346,34 +2544,65 @@ exports[`codegen #formats check we can convert all formats from namespace unvers + + + + + + + + - + - - - + + + + + + +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'odata' 3`] = ` +{ + "key": "org.acme.hr.csdl", + "value": " + + + + + + + + + + + + + + - + - + - + - + - - - + - + @@ -2417,7 +2646,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers - + @@ -2425,6 +2654,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers + + @@ -2437,7 +2668,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers - + @@ -2463,7 +2694,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers - + @@ -2492,9 +2723,9 @@ exports[`codegen #formats check we can convert all formats from namespace unvers }, "components": { "schemas": { - "org.acme.hr.State": { + "org.acme.hr.base.State": { "title": "State", - "description": "An instance of org.acme.hr.State", + "description": "An instance of org.acme.hr.base.State", "enum": [ "MA", "NY", @@ -2504,16 +2735,25 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "CA" ] }, - "org.acme.hr.Address": { + "org.acme.hr.base.TShirtSizeType": { + "title": "TShirtSizeType", + "description": "An instance of org.acme.hr.base.TShirtSizeType", + "enum": [ + "SMALL", + "MEDIUM", + "LARGE" + ] + }, + "org.acme.hr.base.Address": { "title": "Address", - "description": "An instance of org.acme.hr.Address", + "description": "An instance of org.acme.hr.base.Address", "type": "object", "properties": { "$class": { "type": "string", - "default": "org.acme.hr.Address", - "pattern": "^org\\\\.acme\\\\.hr\\\\.Address$", - "description": "The class identifier for org.acme.hr.Address" + "default": "org.acme.hr.base.Address", + "pattern": "^org\\\\.acme\\\\.hr\\\\.base\\\\.Address$", + "description": "The class identifier for org.acme.hr.base.Address" }, "street": { "type": "string" @@ -2522,7 +2762,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "state": { - "$ref": "#/components/schemas/org.acme.hr.State" + "$ref": "#/components/schemas/org.acme.hr.base.State" }, "zipCode": { "type": "string" @@ -2536,19 +2776,17 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "street", "city", "zipCode", - "country", - "dictionary1", - "dictionary2", - "dictionary3", - "dictionary4", - "dictionary5", - "dictionary6" + "country" ] }, - "org.acme.hr.Time": { + "org.acme.hr.base.Time": { "format": "date-time", "type": "string" }, + "org.acme.hr.base.SSN": { + "type": "string", + "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" + }, "org.acme.hr.Company": { "title": "Company", "description": "An instance of org.acme.hr.Company", @@ -2564,7 +2802,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "headquarters": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" } }, "required": [ @@ -2642,10 +2880,6 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "serialNumber" ] }, - "org.acme.hr.SSN": { - "type": "string", - "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" - }, "org.acme.hr.Person": { "title": "Person", "description": "An instance of org.acme.hr.Person", @@ -2671,7 +2905,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -2694,7 +2928,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ], "$decorators": { "resource": [] @@ -2727,7 +2962,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "$ref": "#/components/schemas/org.acme.hr.Department" }, "officeAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" }, "companyAssets": { "type": "array", @@ -2760,7 +2995,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -2790,7 +3025,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr.Contractor": { @@ -2825,7 +3061,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -2849,7 +3085,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr.Manager": { @@ -2886,7 +3123,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "$ref": "#/components/schemas/org.acme.hr.Department" }, "officeAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" }, "companyAssets": { "type": "array", @@ -2919,7 +3156,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" }, "ssn": { "default": "000-00-0000", @@ -2949,7 +3186,8 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr.CompanyEvent": { @@ -3005,7 +3243,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "description": "The identifier of an instance of org.acme.hr.Person" }, "newAddress": { - "$ref": "#/components/schemas/org.acme.hr.Address" + "$ref": "#/components/schemas/org.acme.hr.base.Address" } }, "required": [ @@ -3013,6 +3251,13 @@ exports[`codegen #formats check we can convert all formats from namespace unvers "Person", "newAddress" ] + }, + "org.acme.hr.KinName": { + "type": "string" + }, + "org.acme.hr.KinTelephone": { + "format": "date-time", + "type": "string" } } }, @@ -3276,7 +3521,7 @@ exports[`codegen #formats check we can convert all formats from namespace unvers title Model endtitle -class org.acme.hr.State << (E,grey) >> { +class org.acme.hr.base.State << (E,grey) >> { + MA + NY + CO @@ -3284,24 +3529,29 @@ class org.acme.hr.State << (E,grey) >> { + IL + CA } -org.acme.hr.State --|> concerto_1_0_0.Concept -class org.acme.hr.Address { +org.acme.hr.base.State --|> concerto_1_0_0.Concept +class org.acme.hr.base.TShirtSizeType << (E,grey) >> { + + SMALL + + MEDIUM + + LARGE +} +org.acme.hr.base.TShirtSizeType --|> concerto_1_0_0.Concept +class org.acme.hr.base.Address { + String street + String city + State state + String zipCode + String country - + Map1 dictionary1 - + Map2 dictionary2 - + Map3 dictionary3 - + Map4 dictionary4 - + Map5 dictionary5 - + Map6 dictionary6 -} -org.acme.hr.Address --|> concerto_1_0_0.Concept +} +org.acme.hr.base.Address --|> concerto_1_0_0.Concept class org.acme.hr.Company { + String name + Address headquarters + + CompanyProperties companyProperties + + EmployeeDirectory employeeDirectory + + EmployeeTShirtSizes employeeTShirtSizes + + EmployeeProfiles employeeProfiles + + EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers } org.acme.hr.Company --|> concerto_1_0_0.Concept class org.acme.hr.Department << (E,grey) >> { @@ -3335,6 +3585,7 @@ class org.acme.hr.Person << (P,lightblue) >> { + String ssn + Double height + DateTime dob + + NextOfKin nextOfKin } org.acme.hr.Person --|> concerto_1_0_0.Participant class org.acme.hr.Employee << (P,lightblue) >> { @@ -3381,10 +3632,10 @@ org.acme.hr.ChangeOfAddress --|> concerto_1_0_0.Transaction exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'protobuf' 1`] = ` { - "key": "org.acme.hr.v.proto", + "key": "org.acme.hr.base.v.proto", "value": "syntax = "proto3"; -package org.acme.hr.v; +package org.acme.hr.base.v; import "google/protobuf/timestamp.proto"; @@ -3397,23 +3648,42 @@ enum State { State_WA = 5; } +enum TShirtSizeType { + TShirtSizeType_LARGE = 0; + TShirtSizeType_MEDIUM = 1; + TShirtSizeType_SMALL = 2; +} + message Address { string city = 1; string country = 2; - Map1 dictionary1 = 3; - Map2 dictionary2 = 4; - Map3 dictionary3 = 5; - Map4 dictionary4 = 6; - Map5 dictionary5 = 7; - Map6 dictionary6 = 8; - optional State state = 9; - string street = 10; - string zipCode = 11; + optional State state = 3; + string street = 4; + string zipCode = 5; +} + +", } +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'protobuf' 2`] = ` +{ + "key": "org.acme.hr.v.proto", + "value": "syntax = "proto3"; + +package org.acme.hr.v; + +import "google/protobuf/timestamp.proto"; +import "org.acme.hr.base.v.proto"; message Company { - Address headquarters = 1; - string name = 2; + optional CompanyProperties companyProperties = 1; + optional EmployeeDirectory employeeDirectory = 2; + optional EmployeeProfiles employeeProfiles = 3; + optional EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers = 4; + optional EmployeeTShirtSizes employeeTShirtSizes = 5; + Address headquarters = 6; + string name = 7; } enum Department { @@ -3461,11 +3731,12 @@ message Employee { string lastName = 9; optional string manager = 10; optional string middleNames = 11; - sint64 numDependents = 12; - Address officeAddress = 13; - bool retired = 14; - sint64 salary = 15; - string ssn = 16; + NextOfKin nextOfKin = 12; + sint64 numDependents = 13; + Address officeAddress = 14; + bool retired = 15; + sint64 salary = 16; + string ssn = 17; } message _Subclasses_of_class_Employee { @@ -3485,7 +3756,8 @@ message Contractor { string lastName = 7; optional string manager = 8; optional string middleNames = 9; - string ssn = 10; + NextOfKin nextOfKin = 10; + string ssn = 11; } message Manager { @@ -3500,12 +3772,13 @@ message Manager { string lastName = 9; optional string manager = 10; optional string middleNames = 11; - sint64 numDependents = 12; - Address officeAddress = 13; - repeated string reports = 14; - bool retired = 15; - sint64 salary = 16; - string ssn = 17; + NextOfKin nextOfKin = 12; + sint64 numDependents = 13; + Address officeAddress = 14; + repeated string reports = 15; + bool retired = 16; + sint64 salary = 17; + string ssn = 18; } message CompanyEvent { @@ -3539,6 +3812,8 @@ pub mod concerto_1_0_0; #[allow(unused_imports)] pub mod concerto; #[allow(unused_imports)] +pub mod org_acme_hr_base; +#[allow(unused_imports)] pub mod org_acme_hr; #[allow(unused_imports)] pub mod utils; @@ -3733,7 +4008,7 @@ pub struct Event { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'rust' 5`] = ` { - "key": "org_acme_hr.rs", + "key": "org_acme_hr_base.rs", "value": "use serde::{ Deserialize, Serialize }; use chrono::{ DateTime, TimeZone, Utc }; @@ -3756,6 +4031,16 @@ pub enum State { CA, } +#[derive(Debug, Serialize, Deserialize)] +pub enum TShirtSizeType { + #[allow(non_camel_case_types)] + SMALL, + #[allow(non_camel_case_types)] + MEDIUM, + #[allow(non_camel_case_types)] + LARGE, +} + #[derive(Debug, Serialize, Deserialize)] pub struct Address { #[serde( @@ -3788,54 +4073,68 @@ pub struct Address { rename = "country", )] pub country: String, - - #[serde( - rename = "dictionary1", - )] - pub dictionary1: Map1, - - #[serde( - rename = "dictionary2", - )] - pub dictionary2: Map2, - +} + +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'rust' 6`] = ` +{ + "key": "org_acme_hr.rs", + "value": "use serde::{ Deserialize, Serialize }; +use chrono::{ DateTime, TimeZone, Utc }; + +use crate::org_acme_hr_base::*; +use crate::concerto_1_0_0::*; +use crate::utils::*; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Company { #[serde( - rename = "dictionary3", + rename = "$class", )] - pub dictionary3: Map3, + pub _class: String, #[serde( - rename = "dictionary4", + rename = "name", )] - pub dictionary4: Map4, + pub name: String, #[serde( - rename = "dictionary5", + rename = "headquarters", )] - pub dictionary5: Map5, + pub headquarters: Address, #[serde( - rename = "dictionary6", + rename = "companyProperties", + skip_serializing_if = "Option::is_none", )] - pub dictionary6: Map6, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Company { + pub company_properties: Option, + #[serde( - rename = "$class", + rename = "employeeDirectory", + skip_serializing_if = "Option::is_none", )] - pub _class: String, + pub employee_directory: Option, #[serde( - rename = "name", + rename = "employeeTShirtSizes", + skip_serializing_if = "Option::is_none", )] - pub name: String, + pub employee_t_shirt_sizes: Option, #[serde( - rename = "headquarters", + rename = "employeeProfiles", + skip_serializing_if = "Option::is_none", )] - pub headquarters: Address, + pub employee_profiles: Option, + + #[serde( + rename = "employeeSocialSecurityNumbers", + skip_serializing_if = "Option::is_none", + )] + pub employee_social_security_numbers: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -3953,6 +4252,11 @@ pub struct Person { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -4047,6 +4351,11 @@ pub struct Employee { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -4111,6 +4420,11 @@ pub struct Contractor { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -4208,6 +4522,11 @@ pub struct Manager { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -4285,7 +4604,10 @@ exports[`codegen #formats check we can convert all formats from namespace unvers // Warning: Beware of circular dependencies when modifying these imports import type { State, - IAddress, + TShirtSizeType, + IAddress +} from './org.acme.hr.base'; +import type { ICompany, Department, LaptopMake @@ -4380,20 +4702,12 @@ export interface IEvent extends IConcept { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'typescript' 3`] = ` { - "key": "org.acme.hr.ts", + "key": "org.acme.hr.base.ts", "value": "/* eslint-disable @typescript-eslint/no-empty-interface */ -// Generated code for namespace: org.acme.hr +// Generated code for namespace: org.acme.hr.base // imports - -// Warning: Beware of circular dependencies when modifying these imports - -// Warning: Beware of circular dependencies when modifying these imports - -// Warning: Beware of circular dependencies when modifying these imports - -// Warning: Beware of circular dependencies when modifying these imports -import {IConcept,IAsset,IParticipant,IEvent,ITransaction} from './concerto@1.0.0'; +import {IConcept} from './concerto@1.0.0'; // interfaces export enum State { @@ -4405,35 +4719,65 @@ export enum State { CA = 'CA', } +export enum TShirtSizeType { + SMALL = 'SMALL', + MEDIUM = 'MEDIUM', + LARGE = 'LARGE', +} + +export type EmployeeTShirtSizes = Map; + export interface IAddress extends IConcept { street: string; city: string; state?: State; zipCode: string; country: string; - dictionary1: Map1; - dictionary2: Map2; - dictionary3: Map3; - dictionary4: Map4; - dictionary5: Map5; - dictionary6: Map6; } -export type Map1 = Map; +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'typescript' 4`] = ` +{ + "key": "org.acme.hr.ts", + "value": "/* eslint-disable @typescript-eslint/no-empty-interface */ +// Generated code for namespace: org.acme.hr + +// imports + +// Warning: Beware of circular dependencies when modifying these imports + +// Warning: Beware of circular dependencies when modifying these imports + +// Warning: Beware of circular dependencies when modifying these imports + +// Warning: Beware of circular dependencies when modifying these imports +import {IAddress,IEmployeeTShirtSizes,ISSN} from './org.acme.hr.base'; +import {IConcept,IAsset,IParticipant,IEvent,ITransaction} from './concerto@1.0.0'; + +// interfaces +export type CompanyProperties = Map; -export type Map2 = Map; +export type EmployeeLoginTimes = Map; -export type Map3 = Map; +export type EmployeeSocialSecurityNumbers = Map; -export type Map4 = Map; +export type NextOfKin = Map; -export type Map5 = Map; +export type EmployeeProfiles = Map; -export type Map6 = Map; +export type EmployeeDirectory = Map; export interface ICompany extends IConcept { name: string; headquarters: IAddress; + companyProperties?: CompanyProperties; + employeeDirectory?: EmployeeDirectory; + employeeTShirtSizes?: EmployeeTShirtSizes; + employeeProfiles?: EmployeeProfiles; + employeeSocialSecurityNumbers?: EmployeeSocialSecurityNumbers; } export enum Department { @@ -4469,6 +4813,7 @@ export interface IPerson extends IParticipant { ssn: string; height: number; dob: Date; + nextOfKin: NextOfKin; } export type PersonUnion = IEmployee | @@ -4516,10 +4861,10 @@ export interface IChangeOfAddress extends ITransaction { exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'vocabulary' 1`] = ` { - "key": "org.acme.hr_en.voc", - "value": "#Generated vocabulary for namespace: org.acme.hr + "key": "org.acme.hr.base_en.voc", + "value": "#Generated vocabulary for namespace: org.acme.hr.base locale: en -namespace: org.acme.hr +namespace: org.acme.hr.base declarations: - State: State properties: @@ -4529,6 +4874,11 @@ declarations: - WA: WA of the State - IL: IL of the State - CA: CA of the State + - TShirtSizeType: TShirt Size Type + properties: + - SMALL: SMALL of the TShirt Size Type + - MEDIUM: MEDIUM of the TShirt Size Type + - LARGE: LARGE of the TShirt Size Type - Address: Address properties: - street: Street of the Address @@ -4536,17 +4886,28 @@ declarations: - state: State of the Address - zipCode: Zip Code of the Address - country: Country of the Address - - dictionary1: Dictionary1 of the Address - - dictionary2: Dictionary2 of the Address - - dictionary3: Dictionary3 of the Address - - dictionary4: Dictionary4 of the Address - - dictionary5: Dictionary5 of the Address - - dictionary6: Dictionary6 of the Address - Time: Time + - SSN: SSN +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'vocabulary' 2`] = ` +{ + "key": "org.acme.hr_en.voc", + "value": "#Generated vocabulary for namespace: org.acme.hr +locale: en +namespace: org.acme.hr +declarations: - Company: Company properties: - name: Name of the Company - headquarters: Headquarters of the Company + - companyProperties: Company Properties of the Company + - employeeDirectory: Employee Directory of the Company + - employeeTShirtSizes: Employee TShirt Sizes of the Company + - employeeProfiles: Employee Profiles of the Company + - employeeSocialSecurityNumbers: Employee Social Security Numbers of the Company - Department: Department properties: - Sales: Sales of the Department @@ -4565,7 +4926,6 @@ declarations: - Laptop: Laptop properties: - make: Make of the Laptop - - SSN: SSN - Person: Person properties: - email: Email of the Person @@ -4576,6 +4936,7 @@ declarations: - ssn: Ssn of the Person - height: Height of the Person - dob: Dob of the Person + - nextOfKin: Next Of Kin of the Person - Employee: Employee properties: - employeeId: Employee Id of the Employee @@ -4601,6 +4962,8 @@ declarations: properties: - Person: Person of the Change Of Address - newAddress: New Address of the Change Of Address + - KinName: Kin Name + - KinTelephone: Kin Telephone ", } `; @@ -4717,9 +5080,9 @@ exports[`codegen #formats check we can convert all formats from namespace unvers exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'xmlschema' 3`] = ` { - "key": "org.acme.hr.xsd", + "key": "org.acme.hr.base.xsd", "value": " - @@ -4733,33 +5096,55 @@ xmlns:concerto="concerto" - + + + + + + + + + - + - - - - - - - + + +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace unversioned CTO, format 'xmlschema' 4`] = ` +{ + "key": "org.acme.hr.xsd", + "value": " + + + - + + + + + + @@ -4811,10 +5196,11 @@ xmlns:concerto="concerto" - + + @@ -4829,7 +5215,7 @@ xmlns:concerto="concerto" - + @@ -4882,7 +5268,7 @@ xmlns:concerto="concerto" - + @@ -4897,7 +5283,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio { "key": "model.mmd", "value": "classDiagram -class \`org.acme.hr@1.0.0.State\` { +class \`org.acme.hr.base@1.0.0.State\` { << enumeration>> + \`MA\` + \`NY\` @@ -4907,35 +5293,40 @@ class \`org.acme.hr@1.0.0.State\` { + \`CA\` } -class \`org.acme.hr@1.0.0.Address\` { +class \`org.acme.hr.base@1.0.0.TShirtSizeType\` { +<< enumeration>> + + \`SMALL\` + + \`MEDIUM\` + + \`LARGE\` +} + +class \`org.acme.hr.base@1.0.0.Address\` { << concept>> + \`String\` \`street\` + \`String\` \`city\` + \`State\` \`state\` + \`String\` \`zipCode\` + \`String\` \`country\` - + \`Map1\` \`dictionary1\` - + \`Map2\` \`dictionary2\` - + \`Map3\` \`dictionary3\` - + \`Map4\` \`dictionary4\` - + \`Map5\` \`dictionary5\` - + \`Map6\` \`dictionary6\` -} - -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.State\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map1\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map2\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map3\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map4\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map5\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map6\` +} + +\`org.acme.hr.base@1.0.0.Address\` "1" *-- "1" \`org.acme.hr.base@1.0.0.State\` class \`org.acme.hr@1.0.0.Company\` { << concept>> + \`String\` \`name\` + \`Address\` \`headquarters\` -} - -\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` + + \`CompanyProperties\` \`companyProperties\` + + \`EmployeeDirectory\` \`employeeDirectory\` + + \`EmployeeTShirtSizes\` \`employeeTShirtSizes\` + + \`EmployeeProfiles\` \`employeeProfiles\` + + \`EmployeeSocialSecurityNumbers\` \`employeeSocialSecurityNumbers\` +} + +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.CompanyProperties\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeDirectory\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeProfiles\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` class \`org.acme.hr@1.0.0.Department\` { << enumeration>> + \`Sales\` @@ -4974,10 +5365,12 @@ class \`org.acme.hr@1.0.0.Person\` { + \`String\` \`ssn\` + \`Double\` \`height\` + \`DateTime\` \`dob\` + + \`NextOfKin\` \`nextOfKin\` } -\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` -\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.SSN\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr.base@1.0.0.SSN\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.NextOfKin\` class \`org.acme.hr@1.0.0.Employee\` { << participant>> + \`String\` \`employeeId\` @@ -4991,7 +5384,7 @@ class \`org.acme.hr@1.0.0.Employee\` { } \`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr@1.0.0.Department\` -\`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` +\`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` \`org.acme.hr@1.0.0.Employee\` "1" *-- "*" \`org.acme.hr@1.0.0.Equipment\` \`org.acme.hr@1.0.0.Employee\` "1" o-- "1" \`org.acme.hr@1.0.0.Manager\` : manager \`org.acme.hr@1.0.0.Employee\` --|> \`org.acme.hr@1.0.0.Person\` @@ -5028,7 +5421,7 @@ class \`org.acme.hr@1.0.0.ChangeOfAddress\` { } \`org.acme.hr@1.0.0.ChangeOfAddress\` "1" o-- "1" \`org.acme.hr@1.0.0.Person\` : Person -\`org.acme.hr@1.0.0.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` +\`org.acme.hr@1.0.0.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` ", } `; @@ -5040,7 +5433,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio title Model endtitle -class org.acme.hr_1_0_0.State << (E,grey) >> { +class org.acme.hr.base_1_0_0.State << (E,grey) >> { + MA + NY + CO @@ -5048,31 +5441,34 @@ class org.acme.hr_1_0_0.State << (E,grey) >> { + IL + CA } -class org.acme.hr_1_0_0.Address { +class org.acme.hr.base_1_0_0.TShirtSizeType << (E,grey) >> { + + SMALL + + MEDIUM + + LARGE +} +class org.acme.hr.base_1_0_0.Address { + String street + String city + State state + String zipCode + String country - + Map1 dictionary1 - + Map2 dictionary2 - + Map3 dictionary3 - + Map4 dictionary4 - + Map5 dictionary5 - + Map6 dictionary6 -} -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.State : state -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map1 : dictionary1 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map2 : dictionary2 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map3 : dictionary3 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map4 : dictionary4 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map5 : dictionary5 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map6 : dictionary6 +} +org.acme.hr.base_1_0_0.Address "1" *-- "1" org.acme.hr.base_1_0_0.State : state class org.acme.hr_1_0_0.Company { + String name + Address headquarters -} -org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.Address : headquarters + + CompanyProperties companyProperties + + EmployeeDirectory employeeDirectory + + EmployeeTShirtSizes employeeTShirtSizes + + EmployeeProfiles employeeProfiles + + EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers +} +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr.base_1_0_0.Address : headquarters +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.CompanyProperties : companyProperties +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.EmployeeDirectory : employeeDirectory +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr.base_1_0_0.EmployeeTShirtSizes : employeeTShirtSizes +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.EmployeeProfiles : employeeProfiles +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.EmployeeSocialSecurityNumbers : employeeSocialSecurityNumbers class org.acme.hr_1_0_0.Department << (E,grey) >> { + Sales + Marketing @@ -5102,9 +5498,11 @@ class org.acme.hr_1_0_0.Person << (P,lightblue) >> { + String ssn + Double height + DateTime dob + + NextOfKin nextOfKin } -org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr_1_0_0.Address : homeAddress -org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr_1_0_0.SSN : ssn +org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr.base_1_0_0.Address : homeAddress +org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr.base_1_0_0.SSN : ssn +org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr_1_0_0.NextOfKin : nextOfKin class org.acme.hr_1_0_0.Employee << (P,lightblue) >> { + String employeeId + Long salary @@ -5116,7 +5514,7 @@ class org.acme.hr_1_0_0.Employee << (P,lightblue) >> { + Manager manager } org.acme.hr_1_0_0.Employee "1" *-- "1" org.acme.hr_1_0_0.Department : department -org.acme.hr_1_0_0.Employee "1" *-- "1" org.acme.hr_1_0_0.Address : officeAddress +org.acme.hr_1_0_0.Employee "1" *-- "1" org.acme.hr.base_1_0_0.Address : officeAddress org.acme.hr_1_0_0.Employee "1" *-- "*" org.acme.hr_1_0_0.Equipment : companyAssets org.acme.hr_1_0_0.Employee "1" o-- "1" org.acme.hr_1_0_0.Manager : manager org.acme.hr_1_0_0.Employee --|> org.acme.hr_1_0_0.Person @@ -5144,7 +5542,7 @@ class org.acme.hr_1_0_0.ChangeOfAddress << (T,yellow) >> { + Address newAddress } org.acme.hr_1_0_0.ChangeOfAddress "1" o-- "1" org.acme.hr_1_0_0.Person : Person -org.acme.hr_1_0_0.ChangeOfAddress "1" *-- "1" org.acme.hr_1_0_0.Address : newAddress +org.acme.hr_1_0_0.ChangeOfAddress "1" *-- "1" org.acme.hr.base_1_0_0.Address : newAddress @enduml ", } @@ -5214,8 +5612,8 @@ protocol MyProtocol { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'avro' 3`] = ` { - "key": "org.acme.hr@1.0.0.avdl", - "value": "@namespace("org.acme.hr@1.0.0") + "key": "org.acme.hr.base@1.0.0.avdl", + "value": "@namespace("org.acme.hr.base@1.0.0") protocol MyProtocol { import idl "concerto@1.0.0.avdl"; @@ -5229,23 +5627,42 @@ protocol MyProtocol { CA } + enum TShirtSizeType { + SMALL, + MEDIUM, + LARGE + } + record Address { string street; string city; union { null, State } state; string zipCode; string country; - Map1 dictionary1; - Map2 dictionary2; - Map3 dictionary3; - Map4 dictionary4; - Map5 dictionary5; - Map6 dictionary6; } +} +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'avro' 4`] = ` +{ + "key": "org.acme.hr@1.0.0.avdl", + "value": "@namespace("org.acme.hr@1.0.0") +protocol MyProtocol { + + import idl "org.acme.hr.base@1.0.0.avdl"; + import idl "concerto@1.0.0.avdl"; + record Company { string name; Address headquarters; + union { null, CompanyProperties } companyProperties; + union { null, EmployeeDirectory } employeeDirectory; + union { null, EmployeeTShirtSizes } employeeTShirtSizes; + union { null, EmployeeProfiles } employeeProfiles; + union { null, EmployeeSocialSecurityNumbers } employeeSocialSecurityNumbers; } enum Department { @@ -5281,6 +5698,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record Employee { @@ -5301,6 +5719,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record Contractor { @@ -5315,6 +5734,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record Manager { @@ -5336,6 +5756,7 @@ protocol MyProtocol { double height; @logicalType("timestamp-micros") long dob; + NextOfKin nextOfKin; } record CompanyEvent { @@ -5455,8 +5876,8 @@ public abstract class Event : Concept { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'csharp' 3`] = ` { - "key": "org.acme.hr@1.0.0.cs", - "value": "namespace org.acme.hr; + "key": "org.acme.hr.base@1.0.0.cs", + "value": "namespace org.acme.hr.base; using AccordProject.Concerto; [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public enum State { @@ -5467,32 +5888,49 @@ public enum State { IL, CA, } -[AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = "1.0.0", Name = "Address")] +[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] +public enum TShirtSizeType { + SMALL, + MEDIUM, + LARGE, +} +[AccordProject.Concerto.Type(Namespace = "org.acme.hr.base", Version = "1.0.0", Name = "Address")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] public class Address : Concept { [System.Text.Json.Serialization.JsonPropertyName("$class")] - public override string _class { get; } = "org.acme.hr@1.0.0.Address"; + public override string _class { get; } = "org.acme.hr.base@1.0.0.Address"; public string street { get; set; } public string city { get; set; } public State? state { get; set; } public string zipCode { get; set; } public string country { get; set; } - public Dictionary dictionary1 { get; set; } - public Dictionary dictionary2 { get; set; } - public Dictionary dictionary3 { get; set; } - public Dictionary dictionary4 { get; set; } - public Dictionary dictionary5 { get; set; } - public Dictionary dictionary6 { get; set; } } //Dummy implementation of the scalar declaration to avoid compilation errors. class Time_Dummy {} +//Dummy implementation of the scalar declaration to avoid compilation errors. +class SSN_Dummy {} +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'csharp' 4`] = ` +{ + "key": "org.acme.hr@1.0.0.cs", + "value": "namespace org.acme.hr; +using org.acme.hr.base; +using AccordProject.Concerto; [AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = "1.0.0", Name = "Company")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] public class Company : Concept { [System.Text.Json.Serialization.JsonPropertyName("$class")] public override string _class { get; } = "org.acme.hr@1.0.0.Company"; public string name { get; set; } - public Address headquarters { get; set; } + public org.acme.hr.base.Address headquarters { get; set; } + public Dictionary companyProperties { get; set; } + public Dictionary employeeDirectory { get; set; } + public Dictionary employeeTShirtSizes { get; set; } + public Dictionary employeeProfiles { get; set; } + public Dictionary employeeSocialSecurityNumbers { get; set; } } [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public enum Department { @@ -5523,8 +5961,6 @@ public class Laptop : Equipment { public override string _class { get; } = "org.acme.hr@1.0.0.Laptop"; public LaptopMake make { get; set; } } -//Dummy implementation of the scalar declaration to avoid compilation errors. -class SSN_Dummy {} [AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = "1.0.0", Name = "Person")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] public abstract class Person : Participant { @@ -5535,11 +5971,12 @@ public abstract class Person : Participant { public string firstName { get; set; } public string lastName { get; set; } public string? middleNames { get; set; } - public Address homeAddress { get; set; } + public org.acme.hr.base.Address homeAddress { get; set; } [System.ComponentModel.DataAnnotations.RegularExpression(@"\\d{3}-\\d{2}-\\{4}+", ErrorMessage = "Invalid characters")] public string ssn { get; set; } public float height { get; set; } public System.DateTime dob { get; set; } + public Dictionary nextOfKin { get; set; } } [AccordProject.Concerto.Type(Namespace = "org.acme.hr", Version = "1.0.0", Name = "Employee")] [System.Text.Json.Serialization.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterFactorySystem))] @@ -5551,7 +5988,7 @@ public class Employee : Person { public int numDependents { get; set; } public bool retired { get; set; } public Department department { get; set; } - public Address officeAddress { get; set; } + public org.acme.hr.base.Address officeAddress { get; set; } public Equipment[] companyAssets { get; set; } public Manager manager { get; set; } } @@ -5589,8 +6026,12 @@ public class ChangeOfAddress : Transaction { [System.Text.Json.Serialization.JsonPropertyName("$class")] public override string _class { get; } = "org.acme.hr@1.0.0.ChangeOfAddress"; public Person Person { get; set; } - public Address newAddress { get; set; } + public org.acme.hr.base.Address newAddress { get; set; } } +//Dummy implementation of the scalar declaration to avoid compilation errors. +class KinName_Dummy {} +//Dummy implementation of the scalar declaration to avoid compilation errors. +class KinTelephone_Dummy {} ", } `; @@ -5652,10 +6093,9 @@ type Event struct { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'golang' 3`] = ` { - "key": "org.acme.hr@1.0.0.go", - "value": "// Package org_acme_hr_1_0_0 contains domain objects and was generated from Concerto namespace org.acme.hr@1.0.0. -package org_acme_hr_1_0_0 -import "time" + "key": "org.acme.hr.base@1.0.0.go", + "value": "// Package org_acme_hr_base_1_0_0 contains domain objects and was generated from Concerto namespace org.acme.hr.base@1.0.0. +package org_acme_hr_base_1_0_0 import "concerto_1_0_0"; type State int @@ -5667,6 +6107,12 @@ const ( IL CA ) +type TShirtSizeType int +const ( + SMALL TShirtSizeType = 1 + iota + MEDIUM + LARGE +) type Address struct { concerto_1_0_0.Concept Street string \`json:"street"\` @@ -5674,17 +6120,29 @@ type Address struct { State State \`json:"state"\` ZipCode string \`json:"zipCode"\` Country string \`json:"country"\` - Dictionary1 Map1 \`json:"dictionary1"\` - Dictionary2 Map2 \`json:"dictionary2"\` - Dictionary3 Map3 \`json:"dictionary3"\` - Dictionary4 Map4 \`json:"dictionary4"\` - Dictionary5 Map5 \`json:"dictionary5"\` - Dictionary6 Map6 \`json:"dictionary6"\` } +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'golang' 4`] = ` +{ + "key": "org.acme.hr@1.0.0.go", + "value": "// Package org_acme_hr_1_0_0 contains domain objects and was generated from Concerto namespace org.acme.hr@1.0.0. +package org_acme_hr_1_0_0 +import "time" +import "org_acme_hr_base_1_0_0"; +import "concerto_1_0_0"; + type Company struct { concerto_1_0_0.Concept Name string \`json:"name"\` Headquarters Address \`json:"headquarters"\` + CompanyProperties CompanyProperties \`json:"companyProperties"\` + EmployeeDirectory EmployeeDirectory \`json:"employeeDirectory"\` + EmployeeTShirtSizes EmployeeTShirtSizes \`json:"employeeTShirtSizes"\` + EmployeeProfiles EmployeeProfiles \`json:"employeeProfiles"\` + EmployeeSocialSecurityNumbers EmployeeSocialSecurityNumbers \`json:"employeeSocialSecurityNumbers"\` } type Department int const ( @@ -5718,6 +6176,7 @@ type Person struct { Ssn string \`json:"ssn"\` Height float64 \`json:"height"\` Dob time.Time \`json:"dob"\` + NextOfKin NextOfKin \`json:"nextOfKin"\` } type Employee struct { Person @@ -5760,7 +6219,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "key": "model.gql", "value": "directive @resource on OBJECT | FIELD_DEFINITION scalar DateTime -# namespace org.acme.hr@1.0.0 +# namespace org.acme.hr.base@1.0.0 enum State { MA NY @@ -5769,46 +6228,55 @@ enum State { IL CA } +enum TShirtSizeType { + SMALL + MEDIUM + LARGE +} +type EmployeeTShirtSizes { + key: SSN + value: TShirtSizeType +} type Address { street: String! city: String! state: State zipCode: String! country: String! - dictionary1: Map1! - dictionary2: Map2! - dictionary3: Map3! - dictionary4: Map4! - dictionary5: Map5! - dictionary6: Map6! -} -type Map1 { +} +# namespace org.acme.hr@1.0.0 +type CompanyProperties { key: String value: String } -type Map2 { +type EmployeeLoginTimes { key: String - value: DateTime + value: Time } -type Map3 { +type EmployeeSocialSecurityNumbers { key: String value: SSN } -type Map4 { +type NextOfKin { + key: KinName + value: KinTelephone +} +type EmployeeProfiles { key: String value: Concept } -type Map5 { - key: SSN - value: String -} -type Map6 { +type EmployeeDirectory { key: SSN value: Employee } type Company { name: String! headquarters: Address! + companyProperties: CompanyProperties + employeeDirectory: EmployeeDirectory + employeeTShirtSizes: EmployeeTShirtSizes + employeeProfiles: EmployeeProfiles + employeeSocialSecurityNumbers: EmployeeSocialSecurityNumbers } enum Department { Sales @@ -5840,6 +6308,7 @@ type Person @resource { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type Employee { @@ -5859,6 +6328,7 @@ type Employee { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type Contractor { @@ -5872,6 +6342,7 @@ type Contractor { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type Manager { @@ -5892,6 +6363,7 @@ type Manager { ssn: String! height: Float! dob: DateTime! + nextOfKin: NextOfKin! _identifier: String! } type CompanyEvent { @@ -6035,9 +6507,9 @@ public abstract class Event extends Concept { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 6`] = ` { - "key": "org/acme/hr/State.java", + "key": "org/acme/hr/base/State.java", "value": "// this code is generated and should not be modified -package org.acme.hr; +package org.acme.hr.base; import com.fasterxml.jackson.annotation.*; @JsonIgnoreProperties({"$class"}) @@ -6055,9 +6527,26 @@ public enum State { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 7`] = ` { - "key": "org/acme/hr/Address.java", + "key": "org/acme/hr/base/TShirtSizeType.java", "value": "// this code is generated and should not be modified -package org.acme.hr; +package org.acme.hr.base; + +import com.fasterxml.jackson.annotation.*; +@JsonIgnoreProperties({"$class"}) +public enum TShirtSizeType { + SMALL, + MEDIUM, + LARGE, +} +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 8`] = ` +{ + "key": "org/acme/hr/base/Address.java", + "value": "// this code is generated and should not be modified +package org.acme.hr.base; import concerto.Concept; import concerto.Asset; @@ -6073,12 +6562,6 @@ public class Address extends Concept { private State state; private String zipCode; private String country; - private Map1 dictionary1; - private Map2 dictionary2; - private Map3 dictionary3; - private Map4 dictionary4; - private Map5 dictionary5; - private Map6 dictionary6; public String getStreet() { return this.street; } @@ -6094,24 +6577,6 @@ public class Address extends Concept { public String getCountry() { return this.country; } - public Map1 getDictionary1() { - return this.dictionary1; - } - public Map2 getDictionary2() { - return this.dictionary2; - } - public Map3 getDictionary3() { - return this.dictionary3; - } - public Map4 getDictionary4() { - return this.dictionary4; - } - public Map5 getDictionary5() { - return this.dictionary5; - } - public Map6 getDictionary6() { - return this.dictionary6; - } public void setStreet(String street) { this.street = street; } @@ -6127,35 +6592,22 @@ public class Address extends Concept { public void setCountry(String country) { this.country = country; } - public void setDictionary1(Map1 dictionary1) { - this.dictionary1 = dictionary1; - } - public void setDictionary2(Map2 dictionary2) { - this.dictionary2 = dictionary2; - } - public void setDictionary3(Map3 dictionary3) { - this.dictionary3 = dictionary3; - } - public void setDictionary4(Map4 dictionary4) { - this.dictionary4 = dictionary4; - } - public void setDictionary5(Map5 dictionary5) { - this.dictionary5 = dictionary5; - } - public void setDictionary6(Map6 dictionary6) { - this.dictionary6 = dictionary6; - } } ", } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 8`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 9`] = ` { "key": "org/acme/hr/Company.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6167,24 +6619,59 @@ import com.fasterxml.jackson.annotation.*; public class Company extends Concept { private String name; private Address headquarters; + private CompanyProperties companyProperties; + private EmployeeDirectory employeeDirectory; + private EmployeeTShirtSizes employeeTShirtSizes; + private EmployeeProfiles employeeProfiles; + private EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers; public String getName() { return this.name; } public Address getHeadquarters() { return this.headquarters; } + public CompanyProperties getCompanyProperties() { + return this.companyProperties; + } + public EmployeeDirectory getEmployeeDirectory() { + return this.employeeDirectory; + } + public EmployeeTShirtSizes getEmployeeTShirtSizes() { + return this.employeeTShirtSizes; + } + public EmployeeProfiles getEmployeeProfiles() { + return this.employeeProfiles; + } + public EmployeeSocialSecurityNumbers getEmployeeSocialSecurityNumbers() { + return this.employeeSocialSecurityNumbers; + } public void setName(String name) { this.name = name; } public void setHeadquarters(Address headquarters) { this.headquarters = headquarters; } + public void setCompanyProperties(CompanyProperties companyProperties) { + this.companyProperties = companyProperties; + } + public void setEmployeeDirectory(EmployeeDirectory employeeDirectory) { + this.employeeDirectory = employeeDirectory; + } + public void setEmployeeTShirtSizes(EmployeeTShirtSizes employeeTShirtSizes) { + this.employeeTShirtSizes = employeeTShirtSizes; + } + public void setEmployeeProfiles(EmployeeProfiles employeeProfiles) { + this.employeeProfiles = employeeProfiles; + } + public void setEmployeeSocialSecurityNumbers(EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers) { + this.employeeSocialSecurityNumbers = employeeSocialSecurityNumbers; + } } ", } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 9`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 10`] = ` { "key": "org/acme/hr/Department.java", "value": "// this code is generated and should not be modified @@ -6204,12 +6691,17 @@ public enum Department { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 10`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 11`] = ` { "key": "org/acme/hr/Equipment.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6238,7 +6730,7 @@ public abstract class Equipment extends Asset { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 11`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 12`] = ` { "key": "org/acme/hr/LaptopMake.java", "value": "// this code is generated and should not be modified @@ -6254,12 +6746,17 @@ public enum LaptopMake { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 12`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 13`] = ` { "key": "org/acme/hr/Laptop.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6288,12 +6785,17 @@ public class Laptop extends Equipment { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 13`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 14`] = ` { "key": "org/acme/hr/Person.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6318,6 +6820,7 @@ public abstract class Person extends Participant { private String ssn; private double height; private java.util.Date dob; + private NextOfKin nextOfKin; public String getEmail() { return this.email; } @@ -6342,6 +6845,9 @@ public abstract class Person extends Participant { public java.util.Date getDob() { return this.dob; } + public NextOfKin getNextOfKin() { + return this.nextOfKin; + } public void setEmail(String email) { this.email = email; } @@ -6366,17 +6872,25 @@ public abstract class Person extends Participant { public void setDob(java.util.Date dob) { this.dob = dob; } + public void setNextOfKin(NextOfKin nextOfKin) { + this.nextOfKin = nextOfKin; + } } ", } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 14`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 15`] = ` { "key": "org/acme/hr/Employee.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6454,12 +6968,17 @@ public class Employee extends Person { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 15`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 16`] = ` { "key": "org/acme/hr/Contractor.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6495,12 +7014,17 @@ public class Contractor extends Person { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 16`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 17`] = ` { "key": "org/acme/hr/Manager.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6529,12 +7053,17 @@ public class Manager extends Employee { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 17`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 18`] = ` { "key": "org/acme/hr/CompanyEvent.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6548,12 +7077,17 @@ public class CompanyEvent extends Event { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 18`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 19`] = ` { "key": "org/acme/hr/Onboarded.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6574,12 +7108,17 @@ public class Onboarded extends CompanyEvent { } `; -exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 19`] = ` +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'java' 20`] = ` { "key": "org/acme/hr/ChangeOfAddress.java", "value": "// this code is generated and should not be modified package org.acme.hr; +import org.acme.hr.base.Address; +import org.acme.hr.base.State; +import org.acme.hr.base.SSN; +import org.acme.hr.base.Time; +import org.acme.hr.base.EmployeeTShirtSizes; import concerto.Concept; import concerto.Asset; import concerto.Transaction; @@ -6613,9 +7152,9 @@ exports[`codegen #formats check we can convert all formats from namespace versio "value": "{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "org.acme.hr@1.0.0.State": { + "org.acme.hr.base@1.0.0.State": { "title": "State", - "description": "An instance of org.acme.hr@1.0.0.State", + "description": "An instance of org.acme.hr.base@1.0.0.State", "enum": [ "MA", "NY", @@ -6625,16 +7164,25 @@ exports[`codegen #formats check we can convert all formats from namespace versio "CA" ] }, - "org.acme.hr@1.0.0.Address": { + "org.acme.hr.base@1.0.0.TShirtSizeType": { + "title": "TShirtSizeType", + "description": "An instance of org.acme.hr.base@1.0.0.TShirtSizeType", + "enum": [ + "SMALL", + "MEDIUM", + "LARGE" + ] + }, + "org.acme.hr.base@1.0.0.Address": { "title": "Address", - "description": "An instance of org.acme.hr@1.0.0.Address", + "description": "An instance of org.acme.hr.base@1.0.0.Address", "type": "object", "properties": { "$class": { "type": "string", - "default": "org.acme.hr@1.0.0.Address", - "pattern": "^org\\\\.acme\\\\.hr@1\\\\.0\\\\.0\\\\.Address$", - "description": "The class identifier for org.acme.hr@1.0.0.Address" + "default": "org.acme.hr.base@1.0.0.Address", + "pattern": "^org\\\\.acme\\\\.hr\\\\.base@1\\\\.0\\\\.0\\\\.Address$", + "description": "The class identifier for org.acme.hr.base@1.0.0.Address" }, "street": { "type": "string" @@ -6643,7 +7191,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "state": { - "$ref": "#/definitions/org.acme.hr@1.0.0.State" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.State" }, "zipCode": { "type": "string" @@ -6657,19 +7205,17 @@ exports[`codegen #formats check we can convert all formats from namespace versio "street", "city", "zipCode", - "country", - "dictionary1", - "dictionary2", - "dictionary3", - "dictionary4", - "dictionary5", - "dictionary6" + "country" ] }, - "org.acme.hr@1.0.0.Time": { + "org.acme.hr.base@1.0.0.Time": { "format": "date-time", "type": "string" }, + "org.acme.hr.base@1.0.0.SSN": { + "type": "string", + "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" + }, "org.acme.hr@1.0.0.Company": { "title": "Company", "description": "An instance of org.acme.hr@1.0.0.Company", @@ -6685,7 +7231,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "headquarters": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" } }, "required": [ @@ -6763,10 +7309,6 @@ exports[`codegen #formats check we can convert all formats from namespace versio "serialNumber" ] }, - "org.acme.hr@1.0.0.SSN": { - "type": "string", - "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" - }, "org.acme.hr@1.0.0.Person": { "title": "Person", "description": "An instance of org.acme.hr@1.0.0.Person", @@ -6792,7 +7334,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -6815,7 +7357,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ], "$decorators": { "resource": [] @@ -6848,7 +7391,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "$ref": "#/definitions/org.acme.hr@1.0.0.Department" }, "officeAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" }, "companyAssets": { "type": "array", @@ -6881,7 +7424,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -6911,7 +7454,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr@1.0.0.Contractor": { @@ -6946,7 +7490,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -6970,7 +7514,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr@1.0.0.Manager": { @@ -7007,7 +7552,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "$ref": "#/definitions/org.acme.hr@1.0.0.Department" }, "officeAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" }, "companyAssets": { "type": "array", @@ -7040,7 +7585,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -7070,7 +7615,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr@1.0.0.CompanyEvent": { @@ -7126,7 +7672,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "description": "The identifier of an instance of org.acme.hr@1.0.0.Person" }, "newAddress": { - "$ref": "#/definitions/org.acme.hr@1.0.0.Address" + "$ref": "#/definitions/org.acme.hr.base@1.0.0.Address" } }, "required": [ @@ -7134,6 +7680,13 @@ exports[`codegen #formats check we can convert all formats from namespace versio "Person", "newAddress" ] + }, + "org.acme.hr@1.0.0.KinName": { + "type": "string" + }, + "org.acme.hr@1.0.0.KinTelephone": { + "format": "date-time", + "type": "string" } } } @@ -7144,16 +7697,16 @@ exports[`codegen #formats check we can convert all formats from namespace versio exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'markdown' 1`] = ` { "key": "models.md", - "value": "# Namespace org.acme.hr@1.0.0 + "value": "# Namespace org.acme.hr.base@1.0.0 ## Overview -- 2 concepts -- 3 enumerations -- 2 assets -- 4 participants -- 1 transactions -- 2 events -- 22 total declarations +- 1 concepts +- 2 enumerations +- 0 assets +- 0 participants +- 0 transactions +- 0 events +- 6 total declarations ## Imports - concerto@1.0.0.Concept @@ -7165,7 +7718,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio ## Diagram \`\`\`mermaid classDiagram -class \`org.acme.hr@1.0.0.State\` { +class \`org.acme.hr.base@1.0.0.State\` { << enumeration>> + \`MA\` + \`NY\` @@ -7175,35 +7728,68 @@ class \`org.acme.hr@1.0.0.State\` { + \`CA\` } -class \`org.acme.hr@1.0.0.Address\` { +class \`org.acme.hr.base@1.0.0.TShirtSizeType\` { +<< enumeration>> + + \`SMALL\` + + \`MEDIUM\` + + \`LARGE\` +} + +class \`org.acme.hr.base@1.0.0.Address\` { << concept>> + \`String\` \`street\` + \`String\` \`city\` + \`State\` \`state\` + \`String\` \`zipCode\` + \`String\` \`country\` - + \`Map1\` \`dictionary1\` - + \`Map2\` \`dictionary2\` - + \`Map3\` \`dictionary3\` - + \`Map4\` \`dictionary4\` - + \`Map5\` \`dictionary5\` - + \`Map6\` \`dictionary6\` -} - -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.State\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map1\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map2\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map3\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map4\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map5\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map6\` +} + +\`org.acme.hr.base@1.0.0.Address\` "1" *-- "1" \`org.acme.hr.base@1.0.0.State\` +\`\`\` + +# Namespace org.acme.hr@1.0.0 + +## Overview +- 1 concepts +- 2 enumerations +- 2 assets +- 4 participants +- 1 transactions +- 2 events +- 20 total declarations + +## Imports +- org.acme.hr.base@1.0.0.Address +- org.acme.hr.base@1.0.0.State +- org.acme.hr.base@1.0.0.SSN +- org.acme.hr.base@1.0.0.Time +- org.acme.hr.base@1.0.0.EmployeeTShirtSizes +- concerto@1.0.0.Concept +- concerto@1.0.0.Asset +- concerto@1.0.0.Transaction +- concerto@1.0.0.Participant +- concerto@1.0.0.Event + +## Diagram +\`\`\`mermaid +classDiagram class \`org.acme.hr@1.0.0.Company\` { << concept>> + \`String\` \`name\` + \`Address\` \`headquarters\` -} - -\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` + + \`CompanyProperties\` \`companyProperties\` + + \`EmployeeDirectory\` \`employeeDirectory\` + + \`EmployeeTShirtSizes\` \`employeeTShirtSizes\` + + \`EmployeeProfiles\` \`employeeProfiles\` + + \`EmployeeSocialSecurityNumbers\` \`employeeSocialSecurityNumbers\` +} + +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.CompanyProperties\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeDirectory\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeProfiles\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` class \`org.acme.hr@1.0.0.Department\` { << enumeration>> + \`Sales\` @@ -7242,10 +7828,12 @@ class \`org.acme.hr@1.0.0.Person\` { + \`String\` \`ssn\` + \`Double\` \`height\` + \`DateTime\` \`dob\` + + \`NextOfKin\` \`nextOfKin\` } -\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` -\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.SSN\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr.base@1.0.0.SSN\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.NextOfKin\` class \`org.acme.hr@1.0.0.Employee\` { << participant>> + \`String\` \`employeeId\` @@ -7259,7 +7847,7 @@ class \`org.acme.hr@1.0.0.Employee\` { } \`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr@1.0.0.Department\` -\`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` +\`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` \`org.acme.hr@1.0.0.Employee\` "1" *-- "*" \`org.acme.hr@1.0.0.Equipment\` \`org.acme.hr@1.0.0.Employee\` "1" o-- "1" \`org.acme.hr@1.0.0.Manager\` : manager \`org.acme.hr@1.0.0.Employee\` --|> \`org.acme.hr@1.0.0.Person\` @@ -7296,7 +7884,7 @@ class \`org.acme.hr@1.0.0.ChangeOfAddress\` { } \`org.acme.hr@1.0.0.ChangeOfAddress\` "1" o-- "1" \`org.acme.hr@1.0.0.Person\` : Person -\`org.acme.hr@1.0.0.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` +\`org.acme.hr@1.0.0.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` \`\`\` ", @@ -7307,7 +7895,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio { "key": "model.mmd", "value": "classDiagram -class \`org.acme.hr@1.0.0.State\` { +class \`org.acme.hr.base@1.0.0.State\` { << enumeration>> + \`MA\` + \`NY\` @@ -7317,37 +7905,43 @@ class \`org.acme.hr@1.0.0.State\` { + \`CA\` } -\`org.acme.hr@1.0.0.State\` --|> \`concerto@1.0.0.Concept\` -class \`org.acme.hr@1.0.0.Address\` { +\`org.acme.hr.base@1.0.0.State\` --|> \`concerto@1.0.0.Concept\` +class \`org.acme.hr.base@1.0.0.TShirtSizeType\` { +<< enumeration>> + + \`SMALL\` + + \`MEDIUM\` + + \`LARGE\` +} + +\`org.acme.hr.base@1.0.0.TShirtSizeType\` --|> \`concerto@1.0.0.Concept\` +class \`org.acme.hr.base@1.0.0.Address\` { << concept>> + \`String\` \`street\` + \`String\` \`city\` + \`State\` \`state\` + \`String\` \`zipCode\` + \`String\` \`country\` - + \`Map1\` \`dictionary1\` - + \`Map2\` \`dictionary2\` - + \`Map3\` \`dictionary3\` - + \`Map4\` \`dictionary4\` - + \`Map5\` \`dictionary5\` - + \`Map6\` \`dictionary6\` -} - -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.State\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map1\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map2\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map3\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map4\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map5\` -\`org.acme.hr@1.0.0.Address\` "1" *-- "1" \`org.acme.hr@1.0.0.Map6\` -\`org.acme.hr@1.0.0.Address\` --|> \`concerto@1.0.0.Concept\` +} + +\`org.acme.hr.base@1.0.0.Address\` "1" *-- "1" \`org.acme.hr.base@1.0.0.State\` +\`org.acme.hr.base@1.0.0.Address\` --|> \`concerto@1.0.0.Concept\` class \`org.acme.hr@1.0.0.Company\` { << concept>> + \`String\` \`name\` + \`Address\` \`headquarters\` -} - -\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` + + \`CompanyProperties\` \`companyProperties\` + + \`EmployeeDirectory\` \`employeeDirectory\` + + \`EmployeeTShirtSizes\` \`employeeTShirtSizes\` + + \`EmployeeProfiles\` \`employeeProfiles\` + + \`EmployeeSocialSecurityNumbers\` \`employeeSocialSecurityNumbers\` +} + +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.CompanyProperties\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeDirectory\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeProfiles\` +\`org.acme.hr@1.0.0.Company\` "1" *-- "1" \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` \`org.acme.hr@1.0.0.Company\` --|> \`concerto@1.0.0.Concept\` class \`org.acme.hr@1.0.0.Department\` { << enumeration>> @@ -7390,10 +7984,12 @@ class \`org.acme.hr@1.0.0.Person\` { + \`String\` \`ssn\` + \`Double\` \`height\` + \`DateTime\` \`dob\` + + \`NextOfKin\` \`nextOfKin\` } -\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` -\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.SSN\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr.base@1.0.0.SSN\` +\`org.acme.hr@1.0.0.Person\` "1" *-- "1" \`org.acme.hr@1.0.0.NextOfKin\` \`org.acme.hr@1.0.0.Person\` --|> \`concerto@1.0.0.Participant\` class \`org.acme.hr@1.0.0.Employee\` { << participant>> @@ -7408,7 +8004,7 @@ class \`org.acme.hr@1.0.0.Employee\` { } \`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr@1.0.0.Department\` -\`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` +\`org.acme.hr@1.0.0.Employee\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` \`org.acme.hr@1.0.0.Employee\` "1" *-- "*" \`org.acme.hr@1.0.0.Equipment\` \`org.acme.hr@1.0.0.Employee\` "1" o-- "1" \`org.acme.hr@1.0.0.Manager\` : manager \`org.acme.hr@1.0.0.Employee\` --|> \`org.acme.hr@1.0.0.Person\` @@ -7446,7 +8042,7 @@ class \`org.acme.hr@1.0.0.ChangeOfAddress\` { } \`org.acme.hr@1.0.0.ChangeOfAddress\` "1" o-- "1" \`org.acme.hr@1.0.0.Person\` : Person -\`org.acme.hr@1.0.0.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr@1.0.0.Address\` +\`org.acme.hr@1.0.0.ChangeOfAddress\` "1" *-- "1" \`org.acme.hr.base@1.0.0.Address\` \`org.acme.hr@1.0.0.ChangeOfAddress\` --|> \`concerto@1.0.0.Transaction\` ", } @@ -7487,7 +8083,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'odata' 2`] = ` { - "key": "org.acme.hr.csdl", + "key": "org.acme.hr.base.csdl", "value": " @@ -7497,7 +8093,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio - + @@ -7512,34 +8108,65 @@ exports[`codegen #formats check we can convert all formats from namespace versio + + + + + + + + - + - - - + + + + + + +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'odata' 3`] = ` +{ + "key": "org.acme.hr.csdl", + "value": " + + + + + + + + + + + + + + - + - + - + - + - - - + - + @@ -7583,7 +8210,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio - + @@ -7591,6 +8218,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio + + @@ -7603,7 +8232,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio - + @@ -7629,7 +8258,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio - + @@ -7658,9 +8287,9 @@ exports[`codegen #formats check we can convert all formats from namespace versio }, "components": { "schemas": { - "org.acme.hr@1.0.0.State": { + "org.acme.hr.base@1.0.0.State": { "title": "State", - "description": "An instance of org.acme.hr@1.0.0.State", + "description": "An instance of org.acme.hr.base@1.0.0.State", "enum": [ "MA", "NY", @@ -7670,16 +8299,25 @@ exports[`codegen #formats check we can convert all formats from namespace versio "CA" ] }, - "org.acme.hr@1.0.0.Address": { + "org.acme.hr.base@1.0.0.TShirtSizeType": { + "title": "TShirtSizeType", + "description": "An instance of org.acme.hr.base@1.0.0.TShirtSizeType", + "enum": [ + "SMALL", + "MEDIUM", + "LARGE" + ] + }, + "org.acme.hr.base@1.0.0.Address": { "title": "Address", - "description": "An instance of org.acme.hr@1.0.0.Address", + "description": "An instance of org.acme.hr.base@1.0.0.Address", "type": "object", "properties": { "$class": { "type": "string", - "default": "org.acme.hr@1.0.0.Address", - "pattern": "^org\\\\.acme\\\\.hr@1\\\\.0\\\\.0\\\\.Address$", - "description": "The class identifier for org.acme.hr@1.0.0.Address" + "default": "org.acme.hr.base@1.0.0.Address", + "pattern": "^org\\\\.acme\\\\.hr\\\\.base@1\\\\.0\\\\.0\\\\.Address$", + "description": "The class identifier for org.acme.hr.base@1.0.0.Address" }, "street": { "type": "string" @@ -7688,7 +8326,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "state": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.State" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.State" }, "zipCode": { "type": "string" @@ -7702,19 +8340,17 @@ exports[`codegen #formats check we can convert all formats from namespace versio "street", "city", "zipCode", - "country", - "dictionary1", - "dictionary2", - "dictionary3", - "dictionary4", - "dictionary5", - "dictionary6" + "country" ] }, - "org.acme.hr@1.0.0.Time": { + "org.acme.hr.base@1.0.0.Time": { "format": "date-time", "type": "string" }, + "org.acme.hr.base@1.0.0.SSN": { + "type": "string", + "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" + }, "org.acme.hr@1.0.0.Company": { "title": "Company", "description": "An instance of org.acme.hr@1.0.0.Company", @@ -7730,7 +8366,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "headquarters": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" } }, "required": [ @@ -7808,10 +8444,6 @@ exports[`codegen #formats check we can convert all formats from namespace versio "serialNumber" ] }, - "org.acme.hr@1.0.0.SSN": { - "type": "string", - "pattern": "\\\\d{3}-\\\\d{2}-\\\\{4}+" - }, "org.acme.hr@1.0.0.Person": { "title": "Person", "description": "An instance of org.acme.hr@1.0.0.Person", @@ -7837,7 +8469,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -7860,7 +8492,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ], "$decorators": { "resource": [] @@ -7893,7 +8526,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "$ref": "#/components/schemas/org.acme.hr@1.0.0.Department" }, "officeAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" }, "companyAssets": { "type": "array", @@ -7926,7 +8559,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -7956,7 +8589,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr@1.0.0.Contractor": { @@ -7991,7 +8625,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -8015,7 +8649,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr@1.0.0.Manager": { @@ -8052,7 +8687,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "$ref": "#/components/schemas/org.acme.hr@1.0.0.Department" }, "officeAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" }, "companyAssets": { "type": "array", @@ -8085,7 +8720,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "type": "string" }, "homeAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" }, "ssn": { "default": "000-00-0000", @@ -8115,7 +8750,8 @@ exports[`codegen #formats check we can convert all formats from namespace versio "homeAddress", "ssn", "height", - "dob" + "dob", + "nextOfKin" ] }, "org.acme.hr@1.0.0.CompanyEvent": { @@ -8171,7 +8807,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio "description": "The identifier of an instance of org.acme.hr@1.0.0.Person" }, "newAddress": { - "$ref": "#/components/schemas/org.acme.hr@1.0.0.Address" + "$ref": "#/components/schemas/org.acme.hr.base@1.0.0.Address" } }, "required": [ @@ -8179,6 +8815,13 @@ exports[`codegen #formats check we can convert all formats from namespace versio "Person", "newAddress" ] + }, + "org.acme.hr@1.0.0.KinName": { + "type": "string" + }, + "org.acme.hr@1.0.0.KinTelephone": { + "format": "date-time", + "type": "string" } } }, @@ -8442,7 +9085,7 @@ exports[`codegen #formats check we can convert all formats from namespace versio title Model endtitle -class org.acme.hr_1_0_0.State << (E,grey) >> { +class org.acme.hr.base_1_0_0.State << (E,grey) >> { + MA + NY + CO @@ -8450,33 +9093,37 @@ class org.acme.hr_1_0_0.State << (E,grey) >> { + IL + CA } -org.acme.hr_1_0_0.State --|> concerto_1_0_0.Concept -class org.acme.hr_1_0_0.Address { +org.acme.hr.base_1_0_0.State --|> concerto_1_0_0.Concept +class org.acme.hr.base_1_0_0.TShirtSizeType << (E,grey) >> { + + SMALL + + MEDIUM + + LARGE +} +org.acme.hr.base_1_0_0.TShirtSizeType --|> concerto_1_0_0.Concept +class org.acme.hr.base_1_0_0.Address { + String street + String city + State state + String zipCode + String country - + Map1 dictionary1 - + Map2 dictionary2 - + Map3 dictionary3 - + Map4 dictionary4 - + Map5 dictionary5 - + Map6 dictionary6 -} -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.State : state -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map1 : dictionary1 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map2 : dictionary2 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map3 : dictionary3 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map4 : dictionary4 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map5 : dictionary5 -org.acme.hr_1_0_0.Address "1" *-- "1" org.acme.hr_1_0_0.Map6 : dictionary6 -org.acme.hr_1_0_0.Address --|> concerto_1_0_0.Concept +} +org.acme.hr.base_1_0_0.Address "1" *-- "1" org.acme.hr.base_1_0_0.State : state +org.acme.hr.base_1_0_0.Address --|> concerto_1_0_0.Concept class org.acme.hr_1_0_0.Company { + String name + Address headquarters -} -org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.Address : headquarters + + CompanyProperties companyProperties + + EmployeeDirectory employeeDirectory + + EmployeeTShirtSizes employeeTShirtSizes + + EmployeeProfiles employeeProfiles + + EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers +} +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr.base_1_0_0.Address : headquarters +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.CompanyProperties : companyProperties +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.EmployeeDirectory : employeeDirectory +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr.base_1_0_0.EmployeeTShirtSizes : employeeTShirtSizes +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.EmployeeProfiles : employeeProfiles +org.acme.hr_1_0_0.Company "1" *-- "1" org.acme.hr_1_0_0.EmployeeSocialSecurityNumbers : employeeSocialSecurityNumbers org.acme.hr_1_0_0.Company --|> concerto_1_0_0.Concept class org.acme.hr_1_0_0.Department << (E,grey) >> { + Sales @@ -8510,9 +9157,11 @@ class org.acme.hr_1_0_0.Person << (P,lightblue) >> { + String ssn + Double height + DateTime dob + + NextOfKin nextOfKin } -org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr_1_0_0.Address : homeAddress -org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr_1_0_0.SSN : ssn +org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr.base_1_0_0.Address : homeAddress +org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr.base_1_0_0.SSN : ssn +org.acme.hr_1_0_0.Person "1" *-- "1" org.acme.hr_1_0_0.NextOfKin : nextOfKin org.acme.hr_1_0_0.Person --|> concerto_1_0_0.Participant class org.acme.hr_1_0_0.Employee << (P,lightblue) >> { + String employeeId @@ -8525,7 +9174,7 @@ class org.acme.hr_1_0_0.Employee << (P,lightblue) >> { + Manager manager } org.acme.hr_1_0_0.Employee "1" *-- "1" org.acme.hr_1_0_0.Department : department -org.acme.hr_1_0_0.Employee "1" *-- "1" org.acme.hr_1_0_0.Address : officeAddress +org.acme.hr_1_0_0.Employee "1" *-- "1" org.acme.hr.base_1_0_0.Address : officeAddress org.acme.hr_1_0_0.Employee "1" *-- "*" org.acme.hr_1_0_0.Equipment : companyAssets org.acme.hr_1_0_0.Employee "1" o-- "1" org.acme.hr_1_0_0.Manager : manager org.acme.hr_1_0_0.Employee --|> org.acme.hr_1_0_0.Person @@ -8554,7 +9203,7 @@ class org.acme.hr_1_0_0.ChangeOfAddress << (T,yellow) >> { + Address newAddress } org.acme.hr_1_0_0.ChangeOfAddress "1" o-- "1" org.acme.hr_1_0_0.Person : Person -org.acme.hr_1_0_0.ChangeOfAddress "1" *-- "1" org.acme.hr_1_0_0.Address : newAddress +org.acme.hr_1_0_0.ChangeOfAddress "1" *-- "1" org.acme.hr.base_1_0_0.Address : newAddress org.acme.hr_1_0_0.ChangeOfAddress --|> concerto_1_0_0.Transaction @enduml ", @@ -8563,10 +9212,10 @@ org.acme.hr_1_0_0.ChangeOfAddress --|> concerto_1_0_0.Transaction exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'protobuf' 1`] = ` { - "key": "org.acme.hr.v1_0_0.proto", + "key": "org.acme.hr.base.v1_0_0.proto", "value": "syntax = "proto3"; -package org.acme.hr.v1_0_0; +package org.acme.hr.base.v1_0_0; import "google/protobuf/timestamp.proto"; @@ -8579,23 +9228,42 @@ enum State { State_WA = 5; } +enum TShirtSizeType { + TShirtSizeType_LARGE = 0; + TShirtSizeType_MEDIUM = 1; + TShirtSizeType_SMALL = 2; +} + message Address { string city = 1; string country = 2; - Map1 dictionary1 = 3; - Map2 dictionary2 = 4; - Map3 dictionary3 = 5; - Map4 dictionary4 = 6; - Map5 dictionary5 = 7; - Map6 dictionary6 = 8; - optional State state = 9; - string street = 10; - string zipCode = 11; + optional State state = 3; + string street = 4; + string zipCode = 5; } +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'protobuf' 2`] = ` +{ + "key": "org.acme.hr.v1_0_0.proto", + "value": "syntax = "proto3"; + +package org.acme.hr.v1_0_0; + +import "google/protobuf/timestamp.proto"; +import "org.acme.hr.base.v1_0_0.proto"; + message Company { - Address headquarters = 1; - string name = 2; + optional CompanyProperties companyProperties = 1; + optional EmployeeDirectory employeeDirectory = 2; + optional EmployeeProfiles employeeProfiles = 3; + optional EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers = 4; + optional EmployeeTShirtSizes employeeTShirtSizes = 5; + Address headquarters = 6; + string name = 7; } enum Department { @@ -8643,11 +9311,12 @@ message Employee { string lastName = 9; optional string manager = 10; optional string middleNames = 11; - sint64 numDependents = 12; - Address officeAddress = 13; - bool retired = 14; - sint64 salary = 15; - string ssn = 16; + NextOfKin nextOfKin = 12; + sint64 numDependents = 13; + Address officeAddress = 14; + bool retired = 15; + sint64 salary = 16; + string ssn = 17; } message _Subclasses_of_class_Employee { @@ -8667,7 +9336,8 @@ message Contractor { string lastName = 7; optional string manager = 8; optional string middleNames = 9; - string ssn = 10; + NextOfKin nextOfKin = 10; + string ssn = 11; } message Manager { @@ -8682,12 +9352,13 @@ message Manager { string lastName = 9; optional string manager = 10; optional string middleNames = 11; - sint64 numDependents = 12; - Address officeAddress = 13; - repeated string reports = 14; - bool retired = 15; - sint64 salary = 16; - string ssn = 17; + NextOfKin nextOfKin = 12; + sint64 numDependents = 13; + Address officeAddress = 14; + repeated string reports = 15; + bool retired = 16; + sint64 salary = 17; + string ssn = 18; } message CompanyEvent { @@ -8721,6 +9392,8 @@ pub mod concerto_1_0_0; #[allow(unused_imports)] pub mod concerto; #[allow(unused_imports)] +pub mod org_acme_hr_base_1_0_0; +#[allow(unused_imports)] pub mod org_acme_hr_1_0_0; #[allow(unused_imports)] pub mod utils; @@ -8915,7 +9588,7 @@ pub struct Event { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'rust' 5`] = ` { - "key": "org_acme_hr_1_0_0.rs", + "key": "org_acme_hr_base_1_0_0.rs", "value": "use serde::{ Deserialize, Serialize }; use chrono::{ DateTime, TimeZone, Utc }; @@ -8938,6 +9611,16 @@ pub enum State { CA, } +#[derive(Debug, Serialize, Deserialize)] +pub enum TShirtSizeType { + #[allow(non_camel_case_types)] + SMALL, + #[allow(non_camel_case_types)] + MEDIUM, + #[allow(non_camel_case_types)] + LARGE, +} + #[derive(Debug, Serialize, Deserialize)] pub struct Address { #[serde( @@ -8970,54 +9653,68 @@ pub struct Address { rename = "country", )] pub country: String, +} + +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'rust' 6`] = ` +{ + "key": "org_acme_hr_1_0_0.rs", + "value": "use serde::{ Deserialize, Serialize }; +use chrono::{ DateTime, TimeZone, Utc }; - #[serde( - rename = "dictionary1", - )] - pub dictionary1: Map1, +use crate::org_acme_hr_base_1_0_0::*; +use crate::concerto_1_0_0::*; +use crate::utils::*; +#[derive(Debug, Serialize, Deserialize)] +pub struct Company { #[serde( - rename = "dictionary2", + rename = "$class", )] - pub dictionary2: Map2, + pub _class: String, #[serde( - rename = "dictionary3", + rename = "name", )] - pub dictionary3: Map3, + pub name: String, #[serde( - rename = "dictionary4", + rename = "headquarters", )] - pub dictionary4: Map4, + pub headquarters: Address, #[serde( - rename = "dictionary5", + rename = "companyProperties", + skip_serializing_if = "Option::is_none", )] - pub dictionary5: Map5, + pub company_properties: Option, #[serde( - rename = "dictionary6", + rename = "employeeDirectory", + skip_serializing_if = "Option::is_none", )] - pub dictionary6: Map6, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Company { + pub employee_directory: Option, + #[serde( - rename = "$class", + rename = "employeeTShirtSizes", + skip_serializing_if = "Option::is_none", )] - pub _class: String, + pub employee_t_shirt_sizes: Option, #[serde( - rename = "name", + rename = "employeeProfiles", + skip_serializing_if = "Option::is_none", )] - pub name: String, + pub employee_profiles: Option, #[serde( - rename = "headquarters", + rename = "employeeSocialSecurityNumbers", + skip_serializing_if = "Option::is_none", )] - pub headquarters: Address, + pub employee_social_security_numbers: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -9135,6 +9832,11 @@ pub struct Person { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -9229,6 +9931,11 @@ pub struct Employee { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -9293,6 +10000,11 @@ pub struct Contractor { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -9390,6 +10102,11 @@ pub struct Manager { )] pub dob: DateTime, + #[serde( + rename = "nextOfKin", + )] + pub next_of_kin: NextOfKin, + #[serde( rename = "$identifier", )] @@ -9467,7 +10184,10 @@ exports[`codegen #formats check we can convert all formats from namespace versio // Warning: Beware of circular dependencies when modifying these imports import type { State, - IAddress, + TShirtSizeType, + IAddress +} from './org.acme.hr.base@1.0.0'; +import type { ICompany, Department, LaptopMake @@ -9562,20 +10282,12 @@ export interface IEvent extends IConcept { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'typescript' 3`] = ` { - "key": "org.acme.hr@1.0.0.ts", + "key": "org.acme.hr.base@1.0.0.ts", "value": "/* eslint-disable @typescript-eslint/no-empty-interface */ -// Generated code for namespace: org.acme.hr@1.0.0 +// Generated code for namespace: org.acme.hr.base@1.0.0 // imports - -// Warning: Beware of circular dependencies when modifying these imports - -// Warning: Beware of circular dependencies when modifying these imports - -// Warning: Beware of circular dependencies when modifying these imports - -// Warning: Beware of circular dependencies when modifying these imports -import {IConcept,IAsset,IParticipant,IEvent,ITransaction} from './concerto@1.0.0'; +import {IConcept} from './concerto@1.0.0'; // interfaces export enum State { @@ -9587,35 +10299,65 @@ export enum State { CA = 'CA', } +export enum TShirtSizeType { + SMALL = 'SMALL', + MEDIUM = 'MEDIUM', + LARGE = 'LARGE', +} + +export type EmployeeTShirtSizes = Map; + export interface IAddress extends IConcept { street: string; city: string; state?: State; zipCode: string; country: string; - dictionary1: Map1; - dictionary2: Map2; - dictionary3: Map3; - dictionary4: Map4; - dictionary5: Map5; - dictionary6: Map6; } -export type Map1 = Map; +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'typescript' 4`] = ` +{ + "key": "org.acme.hr@1.0.0.ts", + "value": "/* eslint-disable @typescript-eslint/no-empty-interface */ +// Generated code for namespace: org.acme.hr@1.0.0 + +// imports + +// Warning: Beware of circular dependencies when modifying these imports + +// Warning: Beware of circular dependencies when modifying these imports + +// Warning: Beware of circular dependencies when modifying these imports + +// Warning: Beware of circular dependencies when modifying these imports +import {IAddress,IEmployeeTShirtSizes,ISSN} from './org.acme.hr.base@1.0.0'; +import {IConcept,IAsset,IParticipant,IEvent,ITransaction} from './concerto@1.0.0'; -export type Map2 = Map; +// interfaces +export type CompanyProperties = Map; + +export type EmployeeLoginTimes = Map; -export type Map3 = Map; +export type EmployeeSocialSecurityNumbers = Map; -export type Map4 = Map; +export type NextOfKin = Map; -export type Map5 = Map; +export type EmployeeProfiles = Map; -export type Map6 = Map; +export type EmployeeDirectory = Map; export interface ICompany extends IConcept { name: string; headquarters: IAddress; + companyProperties?: CompanyProperties; + employeeDirectory?: EmployeeDirectory; + employeeTShirtSizes?: EmployeeTShirtSizes; + employeeProfiles?: EmployeeProfiles; + employeeSocialSecurityNumbers?: EmployeeSocialSecurityNumbers; } export enum Department { @@ -9651,6 +10393,7 @@ export interface IPerson extends IParticipant { ssn: string; height: number; dob: Date; + nextOfKin: NextOfKin; } export type PersonUnion = IEmployee | @@ -9698,10 +10441,10 @@ export interface IChangeOfAddress extends ITransaction { exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'vocabulary' 1`] = ` { - "key": "org.acme.hr@1.0.0_en.voc", - "value": "#Generated vocabulary for namespace: org.acme.hr@1.0.0 + "key": "org.acme.hr.base@1.0.0_en.voc", + "value": "#Generated vocabulary for namespace: org.acme.hr.base@1.0.0 locale: en -namespace: org.acme.hr@1.0.0 +namespace: org.acme.hr.base@1.0.0 declarations: - State: State properties: @@ -9711,6 +10454,11 @@ declarations: - WA: WA of the State - IL: IL of the State - CA: CA of the State + - TShirtSizeType: TShirt Size Type + properties: + - SMALL: SMALL of the TShirt Size Type + - MEDIUM: MEDIUM of the TShirt Size Type + - LARGE: LARGE of the TShirt Size Type - Address: Address properties: - street: Street of the Address @@ -9718,17 +10466,28 @@ declarations: - state: State of the Address - zipCode: Zip Code of the Address - country: Country of the Address - - dictionary1: Dictionary1 of the Address - - dictionary2: Dictionary2 of the Address - - dictionary3: Dictionary3 of the Address - - dictionary4: Dictionary4 of the Address - - dictionary5: Dictionary5 of the Address - - dictionary6: Dictionary6 of the Address - Time: Time + - SSN: SSN +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'vocabulary' 2`] = ` +{ + "key": "org.acme.hr@1.0.0_en.voc", + "value": "#Generated vocabulary for namespace: org.acme.hr@1.0.0 +locale: en +namespace: org.acme.hr@1.0.0 +declarations: - Company: Company properties: - name: Name of the Company - headquarters: Headquarters of the Company + - companyProperties: Company Properties of the Company + - employeeDirectory: Employee Directory of the Company + - employeeTShirtSizes: Employee TShirt Sizes of the Company + - employeeProfiles: Employee Profiles of the Company + - employeeSocialSecurityNumbers: Employee Social Security Numbers of the Company - Department: Department properties: - Sales: Sales of the Department @@ -9747,7 +10506,6 @@ declarations: - Laptop: Laptop properties: - make: Make of the Laptop - - SSN: SSN - Person: Person properties: - email: Email of the Person @@ -9758,6 +10516,7 @@ declarations: - ssn: Ssn of the Person - height: Height of the Person - dob: Dob of the Person + - nextOfKin: Next Of Kin of the Person - Employee: Employee properties: - employeeId: Employee Id of the Employee @@ -9783,6 +10542,8 @@ declarations: properties: - Person: Person of the Change Of Address - newAddress: New Address of the Change Of Address + - KinName: Kin Name + - KinTelephone: Kin Telephone ", } `; @@ -9899,9 +10660,9 @@ exports[`codegen #formats check we can convert all formats from namespace versio exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'xmlschema' 3`] = ` { - "key": "org.acme.hr@1.0.0.xsd", + "key": "org.acme.hr.base@1.0.0.xsd", "value": " - @@ -9915,33 +10676,55 @@ xmlns:concerto="concerto" - + + + + + + + + + - + - - - - - - - + + +", +} +`; + +exports[`codegen #formats check we can convert all formats from namespace versioned CTO, format 'xmlschema' 4`] = ` +{ + "key": "org.acme.hr@1.0.0.xsd", + "value": " + + + - + + + + + + @@ -9993,10 +10776,11 @@ xmlns:concerto="concerto" - + + @@ -10011,7 +10795,7 @@ xmlns:concerto="concerto" - + @@ -10064,7 +10848,7 @@ xmlns:concerto="concerto" - + diff --git a/test/codegen/codegen.js b/test/codegen/codegen.js index e4933acf..b80204d2 100644 --- a/test/codegen/codegen.js +++ b/test/codegen/codegen.js @@ -37,10 +37,15 @@ describe('codegen', function () { versionedModelManager = new ModelManager(); unversionedModelManager = new ModelManager(); + const base_cto = fs.readFileSync('./test/codegen/fromcto/data/model/hr_base.cto', 'utf-8'); const cto = fs.readFileSync('./test/codegen/fromcto/data/model/hr.cto', 'utf-8'); + + versionedModelManager.addCTOModel(base_cto, 'hr_base.cto'); versionedModelManager.addCTOModel(cto, 'hr.cto'); - const unversionedCto = cto.replace('namespace org.acme.hr@1.0.0', 'namespace org.acme.hr'); + const unversionedBaseCto = base_cto.replace('namespace org.acme.hr.base@1.0.0', 'namespace org.acme.hr.base'); + const unversionedCto = cto.replace('namespace org.acme.hr@1.0.0', 'namespace org.acme.hr').replace('import org.acme.hr.base@1.0.0', 'import org.acme.hr.base'); + unversionedModelManager.addCTOModel(unversionedBaseCto, 'hr_base.cto'); unversionedModelManager.addCTOModel(unversionedCto, 'hr.cto'); }); diff --git a/test/codegen/fromcto/csharp/csharpvisitor.js b/test/codegen/fromcto/csharp/csharpvisitor.js index 91dce556..28c5af63 100644 --- a/test/codegen/fromcto/csharp/csharpvisitor.js +++ b/test/codegen/fromcto/csharp/csharpvisitor.js @@ -1504,18 +1504,16 @@ public class SampleModel : Concept { it('should write a line for field name and type thats a map of ', () => { const mockField = sinon.createStubInstance(Field); - const getAllDeclarations = sinon.stub(); + const getType = sinon.stub(); mockField.dummy = 'Dummy Value'; - mockField.getModelFile.returns({ getAllDeclarations: getAllDeclarations }); + mockField.getModelFile.returns({ getType: getType }); const mockMapDeclaration = sinon.createStubInstance(MapDeclaration); - const findStub = sinon.stub(); const getKeyType = sinon.stub(); const getValueType = sinon.stub(); - getAllDeclarations.returns({ find: findStub }); - findStub.returns(mockMapDeclaration); + getType.returns(mockMapDeclaration); getKeyType.returns('String'); getValueType.returns('String'); mockField.getName.returns('Map1'); @@ -1530,18 +1528,17 @@ public class SampleModel : Concept { it('should write a line for field name and type thats a map of ', () => { const mockField = sinon.createStubInstance(Field); - const getAllDeclarations = sinon.stub(); + const getType = sinon.stub(); mockField.dummy = 'Dummy Value'; - mockField.getModelFile.returns({ getAllDeclarations: getAllDeclarations }); + mockField.getModelFile.returns({ getType: getType }); + let mockMapDeclaration = sinon.createStubInstance(MapDeclaration); - const findStub = sinon.stub(); const getKeyType = sinon.stub(); const getValueType = sinon.stub(); - getAllDeclarations.returns({ find: findStub }); - findStub.returns(mockMapDeclaration); + getType.returns(mockMapDeclaration); getKeyType.returns('String'); getValueType.returns('Concept'); mockField.getName.returns('Map1'); @@ -1556,18 +1553,16 @@ public class SampleModel : Concept { it('should write a line for field name and type thats a map of ', () => { const mockField = sinon.createStubInstance(Field); - const getAllDeclarations = sinon.stub(); + const getType = sinon.stub(); mockField.dummy = 'Dummy Value'; - mockField.getModelFile.returns({ getAllDeclarations: getAllDeclarations }); + mockField.getModelFile.returns({ getType: getType }); let mockMapDeclaration = sinon.createStubInstance(MapDeclaration); - const findStub = sinon.stub(); const getKeyType = sinon.stub(); const getValueType = sinon.stub(); - getAllDeclarations.returns({ find: findStub }); - findStub.returns(mockMapDeclaration); + getType.returns(mockMapDeclaration); getKeyType.returns('String'); getValueType.returns('DateTime'); mockField.getName.returns('Map1'); diff --git a/test/codegen/fromcto/data/model/hr.cto b/test/codegen/fromcto/data/model/hr.cto index 21c53218..cabf4d71 100644 --- a/test/codegen/fromcto/data/model/hr.cto +++ b/test/codegen/fromcto/data/model/hr.cto @@ -1,55 +1,33 @@ namespace org.acme.hr@1.0.0 -enum State { - o MA - o NY - o CO - o WA - o IL - o CA -} - -concept Address { - o String street - o String city - o State state optional - o String zipCode - o String country - o Map1 dictionary1 - o Map2 dictionary2 - o Map3 dictionary3 - o Map4 dictionary4 - o Map5 dictionary5 - o Map6 dictionary6 -} -scalar Time extends DateTime - -map Map1 { +import org.acme.hr.base@1.0.0.{Address, State, SSN, Time, EmployeeTShirtSizes} + +map CompanyProperties { o String o String } -map Map2 { +map EmployeeLoginTimes { o String - o DateTime + o Time } -map Map3 { +map EmployeeSocialSecurityNumbers { o String o SSN } -map Map4 { - o String - o Concept +map NextOfKin { + o KinName + o KinTelephone } -map Map5 { - o SSN +map EmployeeProfiles { o String + o Concept } -map Map6 { +map EmployeeDirectory { o SSN o Employee } @@ -57,6 +35,11 @@ map Map6 { concept Company { o String name o Address headquarters + o CompanyProperties companyProperties optional + o EmployeeDirectory employeeDirectory optional + o EmployeeTShirtSizes employeeTShirtSizes optional + o EmployeeProfiles employeeProfiles optional + o EmployeeSocialSecurityNumbers employeeSocialSecurityNumbers optional } enum Department { @@ -82,8 +65,6 @@ asset Laptop extends Equipment { o LaptopMake make } -scalar SSN extends String default="000-00-0000" regex=/\d{3}-\d{2}-\{4}+/ - @resource abstract participant Person identified by email { o String email @@ -94,6 +75,7 @@ abstract participant Person identified by email { o SSN ssn o Double height o DateTime dob + o NextOfKin nextOfKin } participant Employee extends Person { @@ -107,9 +89,6 @@ participant Employee extends Person { --> Manager manager optional } - - - participant Contractor extends Person { o Company company --> Manager manager optional @@ -130,3 +109,6 @@ transaction ChangeOfAddress { --> Person Person o Address newAddress } + +scalar KinName extends String +scalar KinTelephone extends DateTime diff --git a/test/codegen/fromcto/data/model/hr_base.cto b/test/codegen/fromcto/data/model/hr_base.cto new file mode 100644 index 00000000..9a7fc935 --- /dev/null +++ b/test/codegen/fromcto/data/model/hr_base.cto @@ -0,0 +1,32 @@ +namespace org.acme.hr.base@1.0.0 + +enum State { + o MA + o NY + o CO + o WA + o IL + o CA +} + +enum TShirtSizeType { + o SMALL + o MEDIUM + o LARGE +} + +map EmployeeTShirtSizes { + o SSN + o TShirtSizeType +} + +concept Address { + o String street + o String city + o State state optional + o String zipCode + o String country +} + +scalar Time extends DateTime +scalar SSN extends String default="000-00-0000" regex=/\d{3}-\d{2}-\{4}+/ \ No newline at end of file diff --git a/test/codegen/fromcto/protobuf/data/org.accordproject.protocol.v1_0_0-expected.proto b/test/codegen/fromcto/protobuf/data/org.accordproject.protocol.v1_0_0-expected.proto index 42b43a87..7039a281 100644 --- a/test/codegen/fromcto/protobuf/data/org.accordproject.protocol.v1_0_0-expected.proto +++ b/test/codegen/fromcto/protobuf/data/org.accordproject.protocol.v1_0_0-expected.proto @@ -45,7 +45,7 @@ message Code { message Function { Code code = 1; - string emittedTypes = 2; + repeated string emittedTypes = 2; string name = 3; string requestType = 4; string responseType = 5; diff --git a/test/common/graph.js b/test/common/graph.js index 08a9f112..65fd5742 100644 --- a/test/common/graph.js +++ b/test/common/graph.js @@ -35,8 +35,10 @@ describe('graph', function () { beforeEach(function() { modelManager = new ModelManager(); - const cto = fs.readFileSync('./test/codegen/fromcto/data/model/hr.cto', 'utf-8'); - modelManager.addCTOModel(cto, 'hr.cto'); + const hrBase = fs.readFileSync('./test/codegen/fromcto/data/model/hr_base.cto', 'utf-8'); + modelManager.addCTOModel(hrBase, 'hr_base.cto'); + const hr = fs.readFileSync('./test/codegen/fromcto/data/model/hr.cto', 'utf-8'); + modelManager.addCTOModel(hr, 'hr.cto'); }); @@ -53,38 +55,43 @@ describe('graph', function () { graph.print(writer); writer.closeFile(); expect(writer.data.get('graph.mmd')).toEqual(`flowchart LR - \`org.acme.hr@1.0.0.State\` - \`org.acme.hr@1.0.0.State\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Address\` - \`org.acme.hr@1.0.0.Address\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.State\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map1\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map2\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map3\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map4\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map5\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map6\` - \`org.acme.hr@1.0.0.Time\` - \`org.acme.hr@1.0.0.Map1\` - \`org.acme.hr@1.0.0.Map1\` --> \`String\` - \`org.acme.hr@1.0.0.Map2\` - \`org.acme.hr@1.0.0.Map2\` --> \`String\` - \`org.acme.hr@1.0.0.Map2\` --> \`DateTime\` - \`org.acme.hr@1.0.0.Map3\` - \`org.acme.hr@1.0.0.Map3\` --> \`String\` - \`org.acme.hr@1.0.0.Map3\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Map4\` - \`org.acme.hr@1.0.0.Map4\` --> \`String\` - \`org.acme.hr@1.0.0.Map4\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Map5\` - \`org.acme.hr@1.0.0.Map5\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Map5\` --> \`String\` - \`org.acme.hr@1.0.0.Map6\` - \`org.acme.hr@1.0.0.Map6\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Map6\` --> \`org.acme.hr@1.0.0.Employee\` + \`org.acme.hr.base@1.0.0.State\` + \`org.acme.hr.base@1.0.0.State\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.TShirtSizeType\` + \`org.acme.hr.base@1.0.0.TShirtSizeType\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` + \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` --> \`org.acme.hr.base@1.0.0.TShirtSizeType\` + \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr.base@1.0.0.Address\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.Address\` --> \`org.acme.hr.base@1.0.0.State\` + \`org.acme.hr.base@1.0.0.Time\` + \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.CompanyProperties\` + \`org.acme.hr@1.0.0.CompanyProperties\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeLoginTimes\` + \`org.acme.hr@1.0.0.EmployeeLoginTimes\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeLoginTimes\` --> \`org.acme.hr.base@1.0.0.Time\` + \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` + \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.NextOfKin\` + \`org.acme.hr@1.0.0.NextOfKin\` --> \`org.acme.hr@1.0.0.KinName\` + \`org.acme.hr@1.0.0.NextOfKin\` --> \`org.acme.hr@1.0.0.KinTelephone\` + \`org.acme.hr@1.0.0.EmployeeProfiles\` + \`org.acme.hr@1.0.0.EmployeeProfiles\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeProfiles\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr@1.0.0.EmployeeDirectory\` + \`org.acme.hr@1.0.0.EmployeeDirectory\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.EmployeeDirectory\` --> \`org.acme.hr@1.0.0.Employee\` \`org.acme.hr@1.0.0.Company\` \`org.acme.hr@1.0.0.Company\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.Address\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.CompanyProperties\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.EmployeeDirectory\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.EmployeeProfiles\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` \`org.acme.hr@1.0.0.Department\` \`org.acme.hr@1.0.0.Department\` --> \`concerto@1.0.0.Concept\` \`org.acme.hr@1.0.0.Equipment\` @@ -94,15 +101,15 @@ describe('graph', function () { \`org.acme.hr@1.0.0.Laptop\` \`org.acme.hr@1.0.0.Laptop\` --> \`org.acme.hr@1.0.0.Equipment\` \`org.acme.hr@1.0.0.Laptop\` --> \`org.acme.hr@1.0.0.LaptopMake\` - \`org.acme.hr@1.0.0.SSN\` \`org.acme.hr@1.0.0.Person\` \`org.acme.hr@1.0.0.Person\` --> \`concerto@1.0.0.Participant\` - \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.Address\` - \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.SSN\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.NextOfKin\` \`org.acme.hr@1.0.0.Employee\` \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Person\` \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Department\` - \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Address\` + \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr.base@1.0.0.Address\` \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Equipment\` \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Manager\` \`org.acme.hr@1.0.0.Contractor\` @@ -120,10 +127,13 @@ describe('graph', function () { \`org.acme.hr@1.0.0.ChangeOfAddress\` \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`concerto@1.0.0.Transaction\` \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr@1.0.0.Person\` - \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr@1.0.0.Address\` + \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.KinName\` + \`org.acme.hr@1.0.0.KinTelephone\` `); }); + it('should visit find a connected subgraph', function () { const visitor = new ConcertoGraphVisitor(); visitor.should.not.be.null; @@ -138,63 +148,33 @@ describe('graph', function () { const filteredModelManager = modelManager .filter(declaration => connectedGraph.hasVertex(declaration.getFullyQualifiedName())); - expect(filteredModelManager.getModelFiles()).toHaveLength(1); - expect(filteredModelManager.getModelFiles()[0].getAllDeclarations()).toHaveLength(15); + expect(filteredModelManager.getModelFiles()).toHaveLength(2); + expect(filteredModelManager.getModelFiles()[0].getAllDeclarations()).toHaveLength(3); writer.openFile('graph.mmd'); connectedGraph.print(writer); writer.closeFile(); expect(writer.data.get('graph.mmd')).toEqual(`flowchart LR - \`org.acme.hr@1.0.0.State\` - \`org.acme.hr@1.0.0.State\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Address\` - \`org.acme.hr@1.0.0.Address\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.State\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map1\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map2\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map3\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map4\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map5\` - \`org.acme.hr@1.0.0.Address\` --> \`org.acme.hr@1.0.0.Map6\` - \`org.acme.hr@1.0.0.Map1\` - \`org.acme.hr@1.0.0.Map1\` --> \`String\` - \`org.acme.hr@1.0.0.Map2\` - \`org.acme.hr@1.0.0.Map2\` --> \`String\` - \`org.acme.hr@1.0.0.Map2\` --> \`DateTime\` - \`org.acme.hr@1.0.0.Map3\` - \`org.acme.hr@1.0.0.Map3\` --> \`String\` - \`org.acme.hr@1.0.0.Map3\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Map4\` - \`org.acme.hr@1.0.0.Map4\` --> \`String\` - \`org.acme.hr@1.0.0.Map4\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Map5\` - \`org.acme.hr@1.0.0.Map5\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Map5\` --> \`String\` - \`org.acme.hr@1.0.0.Map6\` - \`org.acme.hr@1.0.0.Map6\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Map6\` --> \`org.acme.hr@1.0.0.Employee\` - \`org.acme.hr@1.0.0.Department\` - \`org.acme.hr@1.0.0.Department\` --> \`concerto@1.0.0.Concept\` - \`org.acme.hr@1.0.0.Equipment\` - \`org.acme.hr@1.0.0.Equipment\` --> \`concerto@1.0.0.Asset\` - \`org.acme.hr@1.0.0.SSN\` + \`org.acme.hr.base@1.0.0.State\` + \`org.acme.hr.base@1.0.0.State\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr.base@1.0.0.Address\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.Address\` --> \`org.acme.hr.base@1.0.0.State\` + \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.NextOfKin\` + \`org.acme.hr@1.0.0.NextOfKin\` --> \`org.acme.hr@1.0.0.KinName\` + \`org.acme.hr@1.0.0.NextOfKin\` --> \`org.acme.hr@1.0.0.KinTelephone\` \`org.acme.hr@1.0.0.Person\` \`org.acme.hr@1.0.0.Person\` --> \`concerto@1.0.0.Participant\` - \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.Address\` - \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.SSN\` - \`org.acme.hr@1.0.0.Employee\` - \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Person\` - \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Department\` - \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Address\` - \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Equipment\` - \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Manager\` - \`org.acme.hr@1.0.0.Manager\` - \`org.acme.hr@1.0.0.Manager\` --> \`org.acme.hr@1.0.0.Employee\` - \`org.acme.hr@1.0.0.Manager\` --> \`org.acme.hr@1.0.0.Person\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.NextOfKin\` \`org.acme.hr@1.0.0.ChangeOfAddress\` \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`concerto@1.0.0.Transaction\` \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr@1.0.0.Person\` - \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr@1.0.0.Address\` + \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.KinName\` + \`org.acme.hr@1.0.0.KinTelephone\` `); }); }); diff --git a/types/lib/codegen/fromcto/graphql/graphqlvisitor.d.ts b/types/lib/codegen/fromcto/graphql/graphqlvisitor.d.ts index b4aa57cc..6deecc6c 100644 --- a/types/lib/codegen/fromcto/graphql/graphqlvisitor.d.ts +++ b/types/lib/codegen/fromcto/graphql/graphqlvisitor.d.ts @@ -66,6 +66,14 @@ declare class GraphQLVisitor { private visitEnumValueDeclaration; /** * Visitor design pattern + * @param {MapDeclaration} mapDeclaration - the object being visited + * @param {Object} parameters - the parameter + * @return {Object} the result of visiting or null + * @private + */ + private visitMapDeclaration; + /** + * Visitor design pattern * @param {Relationship} relationship - the object being visited * @param {Object} parameters - the parameter * @return {Object} the result of visiting or null