From 4d73a085be7571cfeca9d8adfbc9ebb00a0d720b Mon Sep 17 00:00:00 2001 From: Jamie Shorten Date: Tue, 24 Oct 2023 10:21:21 +0100 Subject: [PATCH] chore(deps): update metamodel to support maps and scalars (#26) Signed-off-by: Jamie Shorten --- AccordProject.Concerto.Tests/data/patent.json | 180 ++--- .../AccordProject.Concerto.csproj | 1 + .../ConcertoMetamodelTypes.cs | 139 +++- .../ConcertoJsonConverter.csproj | 1 + ConcertoJsonConverter/concerto.cs | 79 +- ConcertoJsonConverter/concerto.metamodel.cs | 759 ++++++++++++++---- .../models/concerto.metamodel.cto | 96 ++- ConcertoJsonConverter/org.test.cs | 27 +- 8 files changed, 957 insertions(+), 325 deletions(-) diff --git a/AccordProject.Concerto.Tests/data/patent.json b/AccordProject.Concerto.Tests/data/patent.json index 1a07230..715c842 100644 --- a/AccordProject.Concerto.Tests/data/patent.json +++ b/AccordProject.Concerto.Tests/data/patent.json @@ -48,13 +48,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1317, + "offset": 1286, "line": 32, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1342, + "offset": 1310, "line": 33, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -73,13 +73,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1342, + "offset": 1310, "line": 33, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1378, + "offset": 1345, "line": 34, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -98,13 +98,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1378, + "offset": 1345, "line": 34, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1412, + "offset": 1378, "line": 35, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -115,13 +115,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1282, + "offset": 1252, "line": 31, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1413, + "offset": 1379, "line": 35, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -141,13 +141,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1483, + "offset": 1444, "line": 40, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1525, + "offset": 1485, "line": 41, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -162,13 +162,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1525, + "offset": 1485, "line": 41, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1570, + "offset": 1529, "line": 42, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -179,13 +179,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1449, + "offset": 1411, "line": 39, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1571, + "offset": 1530, "line": 42, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -209,13 +209,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1642, + "offset": 1595, "line": 48, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1680, + "offset": 1632, "line": 49, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -234,13 +234,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1680, + "offset": 1632, "line": 49, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1720, + "offset": 1671, "line": 50, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -251,13 +251,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1601, + "offset": 1555, "line": 47, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1721, + "offset": 1672, "line": 50, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -276,13 +276,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1750, + "offset": 1697, "line": 54, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1791, + "offset": 1737, "line": 55, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -301,13 +301,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1821, + "offset": 1762, "line": 60, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1861, + "offset": 1801, "line": 61, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -328,13 +328,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1916, + "offset": 1852, "line": 65, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1945, + "offset": 1880, "line": 66, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -347,13 +347,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1945, + "offset": 1880, "line": 66, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1969, + "offset": 1903, "line": 67, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -366,13 +366,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1969, + "offset": 1903, "line": 67, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 1999, + "offset": 1932, "line": 68, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -385,13 +385,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1999, + "offset": 1932, "line": 68, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2024, + "offset": 1956, "line": 69, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -404,13 +404,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2024, + "offset": 1956, "line": 69, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2045, + "offset": 1976, "line": 70, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -421,13 +421,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 1887, + "offset": 1824, "line": 64, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2046, + "offset": 1977, "line": 70, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -444,13 +444,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2097, + "offset": 2024, "line": 74, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2125, + "offset": 2051, "line": 75, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -463,13 +463,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2125, + "offset": 2051, "line": 75, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2157, + "offset": 2082, "line": 76, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -480,13 +480,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2070, + "offset": 1998, "line": 73, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2158, + "offset": 2083, "line": 76, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -503,13 +503,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2203, + "offset": 2125, "line": 79, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2231, + "offset": 2152, "line": 80, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -522,13 +522,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2231, + "offset": 2152, "line": 80, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2253, + "offset": 2173, "line": 81, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" @@ -541,13 +541,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2253, + "offset": 2173, "line": 81, "column": 4, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2277, + "offset": 2196, "line": 82, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -558,13 +558,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2178, + "offset": 2101, "line": 78, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2278, + "offset": 2197, "line": 82, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" @@ -588,13 +588,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2349, + "offset": 2263, "line": 87, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2394, + "offset": 2307, "line": 88, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -609,13 +609,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2394, + "offset": 2307, "line": 88, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2421, + "offset": 2333, "line": 89, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -634,13 +634,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2421, + "offset": 2333, "line": 89, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2465, + "offset": 2376, "line": 90, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -659,13 +659,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2465, + "offset": 2376, "line": 90, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2509, + "offset": 2419, "line": 91, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -684,13 +684,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2509, + "offset": 2419, "line": 91, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2548, + "offset": 2457, "line": 92, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -709,13 +709,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2548, + "offset": 2457, "line": 92, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2588, + "offset": 2496, "line": 93, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -730,13 +730,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2588, + "offset": 2496, "line": 93, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2624, + "offset": 2531, "line": 94, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -751,13 +751,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2624, + "offset": 2531, "line": 94, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2658, + "offset": 2564, "line": 95, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -772,13 +772,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2658, + "offset": 2564, "line": 95, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2691, + "offset": 2596, "line": 96, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -793,13 +793,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2691, + "offset": 2596, "line": 96, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2730, + "offset": 2634, "line": 97, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -818,13 +818,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2730, + "offset": 2634, "line": 97, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2778, + "offset": 2681, "line": 98, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -839,13 +839,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2778, + "offset": 2681, "line": 98, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2820, + "offset": 2722, "line": 99, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -860,13 +860,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2820, + "offset": 2722, "line": 99, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2856, + "offset": 2757, "line": 100, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -881,13 +881,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2856, + "offset": 2757, "line": 100, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2892, + "offset": 2792, "line": 101, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -906,13 +906,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2892, + "offset": 2792, "line": 101, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2938, + "offset": 2837, "line": 102, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -931,13 +931,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2938, + "offset": 2837, "line": 102, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 2980, + "offset": 2878, "line": 103, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -952,13 +952,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2980, + "offset": 2878, "line": 103, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 3013, + "offset": 2910, "line": 104, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -973,13 +973,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 3013, + "offset": 2910, "line": 104, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 3044, + "offset": 2940, "line": 105, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" @@ -998,13 +998,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 3044, + "offset": 2940, "line": 105, "column": 3, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 3087, + "offset": 2982, "line": 106, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" @@ -1015,13 +1015,13 @@ "location": { "$class": "concerto.metamodel@1.0.0.Range", "start": { - "offset": 2324, + "offset": 2239, "line": 86, "column": 1, "$class": "concerto.metamodel@1.0.0.Position" }, "end": { - "offset": 3088, + "offset": 2983, "line": 106, "column": 2, "$class": "concerto.metamodel@1.0.0.Position" diff --git a/AccordProject.Concerto/AccordProject.Concerto.csproj b/AccordProject.Concerto/AccordProject.Concerto.csproj index 90b19ed..5e7f17f 100644 --- a/AccordProject.Concerto/AccordProject.Concerto.csproj +++ b/AccordProject.Concerto/AccordProject.Concerto.csproj @@ -17,6 +17,7 @@ all + diff --git a/AccordProject.Concerto/ConcertoMetamodelTypes.cs b/AccordProject.Concerto/ConcertoMetamodelTypes.cs index db3e561..1b0a5db 100644 --- a/AccordProject.Concerto/ConcertoMetamodelTypes.cs +++ b/AccordProject.Concerto/ConcertoMetamodelTypes.cs @@ -36,7 +36,7 @@ public class Range : Concept { [Newtonsoft.Json.JsonProperty("end")] public Position End { get; set; } [Newtonsoft.Json.JsonProperty("source")] - public string Source { get; set; } + public string? Source { get; set; } } [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "TypeIdentifier")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] @@ -46,7 +46,7 @@ public class TypeIdentifier : Concept { [Newtonsoft.Json.JsonProperty("name")] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("namespace")] - public string Namespace { get; set; } + public string? Namespace { get; set; } } [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "DecoratorLiteral")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] @@ -121,6 +121,7 @@ public class IdentifiedBy : Identified { public abstract class Declaration : Concept { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.Declaration"; + [System.ComponentModel.DataAnnotations.RegularExpression(@"^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$", ErrorMessage = "Invalid characters")] [Newtonsoft.Json.JsonProperty("name")] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("decorators")] @@ -128,6 +129,108 @@ public abstract class Declaration : Concept { [Newtonsoft.Json.JsonProperty("location")] public Range? Location { get; set; } } +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "MapKeyType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public abstract class MapKeyType : Concept { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.MapKeyType"; + [Newtonsoft.Json.JsonProperty("decorators")] + public Decorator?[] Decorators { get; set; } + [Newtonsoft.Json.JsonProperty("location")] + public Range? Location { get; set; } +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "MapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public abstract class MapValueType : Concept { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.MapValueType"; + [Newtonsoft.Json.JsonProperty("decorators")] + public Decorator?[] Decorators { get; set; } + [Newtonsoft.Json.JsonProperty("location")] + public Range? Location { get; set; } +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "MapDeclaration")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class MapDeclaration : Declaration { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.MapDeclaration"; + [Newtonsoft.Json.JsonProperty("key")] + public MapKeyType Key { get; set; } + [Newtonsoft.Json.JsonProperty("value")] + public MapValueType Value { get; set; } +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "StringMapKeyType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class StringMapKeyType : MapKeyType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.StringMapKeyType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "DateTimeMapKeyType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class DateTimeMapKeyType : MapKeyType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.DateTimeMapKeyType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "ObjectMapKeyType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class ObjectMapKeyType : MapKeyType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.ObjectMapKeyType"; + [Newtonsoft.Json.JsonProperty("type")] + public TypeIdentifier Type { get; set; } +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "BooleanMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class BooleanMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.BooleanMapValueType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "DateTimeMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class DateTimeMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.DateTimeMapValueType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "StringMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class StringMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.StringMapValueType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "IntegerMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class IntegerMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.IntegerMapValueType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "LongMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class LongMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.LongMapValueType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "DoubleMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class DoubleMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.DoubleMapValueType"; +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "ObjectMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class ObjectMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.ObjectMapValueType"; + [Newtonsoft.Json.JsonProperty("type")] + public TypeIdentifier Type { get; set; } +} +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "RelationshipMapValueType")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class RelationshipMapValueType : MapValueType { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.RelationshipMapValueType"; + [Newtonsoft.Json.JsonProperty("type")] + public TypeIdentifier Type { get; set; } +} [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "EnumDeclaration")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] public class EnumDeclaration : Declaration { @@ -141,6 +244,7 @@ public class EnumDeclaration : Declaration { public class EnumProperty : Concept { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.EnumProperty"; + [System.ComponentModel.DataAnnotations.RegularExpression(@"^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$", ErrorMessage = "Invalid characters")] [Newtonsoft.Json.JsonProperty("name")] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("decorators")] @@ -191,6 +295,7 @@ public class EventDeclaration : ConceptDeclaration { public abstract class Property : Concept { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.Property"; + [System.ComponentModel.DataAnnotations.RegularExpression(@"^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$", ErrorMessage = "Invalid characters")] [Newtonsoft.Json.JsonProperty("name")] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("isArray")] @@ -216,7 +321,7 @@ public class ObjectProperty : Property { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.ObjectProperty"; [Newtonsoft.Json.JsonProperty("defaultValue")] - public string DefaultValue { get; set; } + public string? DefaultValue { get; set; } [Newtonsoft.Json.JsonProperty("type")] public TypeIdentifier Type { get; set; } } @@ -240,9 +345,11 @@ public class StringProperty : Property { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.StringProperty"; [Newtonsoft.Json.JsonProperty("defaultValue")] - public string DefaultValue { get; set; } + public string? DefaultValue { get; set; } [Newtonsoft.Json.JsonProperty("validator")] public StringRegexValidator? Validator { get; set; } + [Newtonsoft.Json.JsonProperty("lengthValidator")] + public StringLengthValidator? LengthValidator { get; set; } } [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "StringRegexValidator")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] @@ -254,6 +361,16 @@ public class StringRegexValidator : Concept { [Newtonsoft.Json.JsonProperty("flags")] public string Flags { get; set; } } +[AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "StringLengthValidator")] +[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] +public class StringLengthValidator : Concept { + [Newtonsoft.Json.JsonProperty("$class")] + public override string _Class { get; } = "concerto.metamodel@1.0.0.StringLengthValidator"; + [Newtonsoft.Json.JsonProperty("minLength")] + public int? MinLength { get; set; } + [Newtonsoft.Json.JsonProperty("maxLength")] + public int? MaxLength { get; set; } +} [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "DoubleProperty")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] public class DoubleProperty : Property { @@ -322,7 +439,7 @@ public abstract class Import : Concept { [Newtonsoft.Json.JsonProperty("namespace")] public string Namespace { get; set; } [Newtonsoft.Json.JsonProperty("uri")] - public string Uri { get; set; } + public string? Uri { get; set; } } [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "ImportAll")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] @@ -354,9 +471,9 @@ public class Model : Concept { [Newtonsoft.Json.JsonProperty("namespace")] public string Namespace { get; set; } [Newtonsoft.Json.JsonProperty("sourceUri")] - public string SourceUri { get; set; } + public string? SourceUri { get; set; } [Newtonsoft.Json.JsonProperty("concertoVersion")] - public string ConcertoVersion { get; set; } + public string? ConcertoVersion { get; set; } [Newtonsoft.Json.JsonProperty("imports")] public Import?[] Imports { get; set; } [Newtonsoft.Json.JsonProperty("declarations")] @@ -384,7 +501,7 @@ public class BooleanScalar : ScalarDeclaration { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.BooleanScalar"; [Newtonsoft.Json.JsonProperty("defaultValue")] - public bool DefaultValue { get; set; } + public bool? DefaultValue { get; set; } } [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "IntegerScalar")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] @@ -422,9 +539,11 @@ public class StringScalar : ScalarDeclaration { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.StringScalar"; [Newtonsoft.Json.JsonProperty("defaultValue")] - public string DefaultValue { get; set; } + public string? DefaultValue { get; set; } [Newtonsoft.Json.JsonProperty("validator")] public StringRegexValidator? Validator { get; set; } + [Newtonsoft.Json.JsonProperty("lengthValidator")] + public StringLengthValidator? LengthValidator { get; set; } } [AccordProject.Concerto.Type(Namespace = "concerto.metamodel", Version = "1.0.0", Name = "DateTimeScalar")] [Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] @@ -432,5 +551,5 @@ public class DateTimeScalar : ScalarDeclaration { [Newtonsoft.Json.JsonProperty("$class")] public override string _Class { get; } = "concerto.metamodel@1.0.0.DateTimeScalar"; [Newtonsoft.Json.JsonProperty("defaultValue")] - public string DefaultValue { get; set; } + public string? DefaultValue { get; set; } } diff --git a/ConcertoJsonConverter/ConcertoJsonConverter.csproj b/ConcertoJsonConverter/ConcertoJsonConverter.csproj index cdcc5a7..fff5683 100644 --- a/ConcertoJsonConverter/ConcertoJsonConverter.csproj +++ b/ConcertoJsonConverter/ConcertoJsonConverter.csproj @@ -8,6 +8,7 @@ + diff --git a/ConcertoJsonConverter/concerto.cs b/ConcertoJsonConverter/concerto.cs index 716d6a3..4918973 100644 --- a/ConcertoJsonConverter/concerto.cs +++ b/ConcertoJsonConverter/concerto.cs @@ -3,44 +3,45 @@ using Concerto.Serialization; using NewtonsoftJson = Newtonsoft.Json; using NewtonsoftConcerto = Concerto.Serialization.Newtonsoft; + namespace Concerto.Models.concerto { - [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public virtual string _class { get;} = "concerto.Concept"; - } - public abstract class Asset : Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.Asset"; - [JsonPropertyName("$identifier")] - [NewtonsoftJson.JsonProperty("$identifier")] - public string _identifier { get; set; } - } - [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class Participant : Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.Participant"; - [JsonPropertyName("$identifier")] - [NewtonsoftJson.JsonProperty("$identifier")] - public string _identifier { get; set; } - } - public abstract class Transaction : Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.Transaction"; - [JsonPropertyName("$timestamp")] - [NewtonsoftJson.JsonProperty("$timestamp")] - public DateTime _timestamp { get; set; } - } - public abstract class Event : Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.Event"; - [JsonPropertyName("$timestamp")] - [NewtonsoftJson.JsonProperty("$timestamp")] - public DateTime _timestamp { get; set; } - } +[NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] +public abstract class Concept { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public virtual string _class { get; } = "concerto@1.0.0.Concept"; +} +public abstract class Asset : Concept { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto@1.0.0.Asset"; + [JsonPropertyName("$identifier")] + [NewtonsoftJson.JsonProperty("$identifier")] + public string _identifier { get; set; } +} +[NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] +public abstract class Participant : Concept { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto@1.0.0.Participant"; + [JsonPropertyName("$identifier")] + [NewtonsoftJson.JsonProperty("$identifier")] + public string _identifier { get; set; } +} +public abstract class Transaction : Concept { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto@1.0.0.Transaction"; + [JsonPropertyName("$timestamp")] + [NewtonsoftJson.JsonProperty("$timestamp")] + public System.DateTime _timestamp { get; set; } +} +public abstract class Event : Concept { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto@1.0.0.Event"; + [JsonPropertyName("$timestamp")] + [NewtonsoftJson.JsonProperty("$timestamp")] + public System.DateTime _timestamp { get; set; } +} } diff --git a/ConcertoJsonConverter/concerto.metamodel.cs b/ConcertoJsonConverter/concerto.metamodel.cs index fd97bba..6adf67a 100644 --- a/ConcertoJsonConverter/concerto.metamodel.cs +++ b/ConcertoJsonConverter/concerto.metamodel.cs @@ -3,266 +3,695 @@ using Concerto.Serialization; using NewtonsoftJson = Newtonsoft.Json; using NewtonsoftConcerto = Concerto.Serialization.Newtonsoft; -namespace Concerto.Models.concerto.metamodel { +namespace Concerto.Models.concerto.metamodel +{ using Concerto.Models.concerto; - public class Position : Concept { + + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class Position : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Position"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Position"; + [JsonPropertyName("line")] + [NewtonsoftJson.JsonProperty("line")] public int line { get; set; } + [JsonPropertyName("column")] + [NewtonsoftJson.JsonProperty("column")] public int column { get; set; } + [JsonPropertyName("offset")] + [NewtonsoftJson.JsonProperty("offset")] public int offset { get; set; } } - public class Range : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class Range : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Range"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Range"; + [JsonPropertyName("start")] + [NewtonsoftJson.JsonProperty("start")] public Position start { get; set; } + [JsonPropertyName("end")] + [NewtonsoftJson.JsonProperty("end")] public Position end { get; set; } - public string source { get; set; } + [JsonPropertyName("source")] + [NewtonsoftJson.JsonProperty("source")] + public string? source { get; set; } } - public class TypeIdentifier : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class TypeIdentifier : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.TypeIdentifier"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.TypeIdentifier"; + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] public string name { get; set; } [JsonPropertyName("namespace")] - [NewtonsoftJson.JsonProperty("namespace")] - public string _namespace { get; set; } + [NewtonsoftJson.JsonProperty("namespace")] + public string? _namespace { get; set; } } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class DecoratorLiteral : Concept { + public abstract class DecoratorLiteral : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DecoratorLiteral"; - public Range location { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DecoratorLiteral"; + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } } - public class DecoratorString : DecoratorLiteral { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DecoratorString : DecoratorLiteral + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DecoratorString"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DecoratorString"; + [JsonPropertyName("value")] + [NewtonsoftJson.JsonProperty("value")] public string value { get; set; } } - public class DecoratorNumber : DecoratorLiteral { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DecoratorNumber : DecoratorLiteral + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DecoratorNumber"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DecoratorNumber"; + [JsonPropertyName("value")] + [NewtonsoftJson.JsonProperty("value")] public float value { get; set; } } - public class DecoratorBoolean : DecoratorLiteral { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DecoratorBoolean : DecoratorLiteral + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DecoratorBoolean"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DecoratorBoolean"; + [JsonPropertyName("value")] + [NewtonsoftJson.JsonProperty("value")] public bool value { get; set; } } - public class DecoratorTypeReference : DecoratorLiteral { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DecoratorTypeReference : DecoratorLiteral + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DecoratorTypeReference"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DecoratorTypeReference"; + [JsonPropertyName("type")] + [NewtonsoftJson.JsonProperty("type")] public TypeIdentifier type { get; set; } + [JsonPropertyName("isArray")] + [NewtonsoftJson.JsonProperty("isArray")] public bool isArray { get; set; } } - public class Decorator : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class Decorator : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Decorator"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Decorator"; + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] public string name { get; set; } - public DecoratorLiteral[] arguments { get; set; } - public Range location { get; set; } + [JsonPropertyName("arguments")] + [NewtonsoftJson.JsonProperty("arguments")] + public DecoratorLiteral?[] Arguments { get; set; } + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public class Identified : Concept { + public class identified : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Identified"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Identified"; } - public class IdentifiedBy : Identified { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class identifiedBy : identified + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.IdentifiedBy"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.IdentifiedBy"; + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] public string name { get; set; } } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class Declaration : Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Declaration"; + public abstract class Declaration : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Declaration"; + [System.ComponentModel.DataAnnotations.RegularExpression(@"^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$", ErrorMessage = "Invalid characters")] + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] public string name { get; set; } - public Decorator[] decorators { get; set; } - public Range location { get; set; } + [JsonPropertyName("decorators")] + [NewtonsoftJson.JsonProperty("decorators")] + public Decorator?[] decorators { get; set; } + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } } - public class EnumDeclaration : Declaration { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public abstract class MapKeyType : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.MapKeyType"; + [JsonPropertyName("decorators")] + [NewtonsoftJson.JsonProperty("decorators")] + public Decorator?[] decorators { get; set; } + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public abstract class MapvalueType : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.MapvalueType"; + [JsonPropertyName("decorators")] + [NewtonsoftJson.JsonProperty("decorators")] + public Decorator?[] decorators { get; set; } + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class MapDeclaration : Declaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.MapDeclaration"; + [JsonPropertyName("key")] + [NewtonsoftJson.JsonProperty("key")] + public MapKeyType key { get; set; } + [JsonPropertyName("value")] + [NewtonsoftJson.JsonProperty("value")] + public MapvalueType value { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class StringMapKeyType : MapKeyType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.EnumDeclaration"; - public EnumProperty[] properties { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.StringMapKeyType"; } - public class EnumProperty : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DateTimeMapKeyType : MapKeyType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.EnumProperty"; - public string name { get; set; } - public Decorator[] decorators { get; set; } - public Range location { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DateTimeMapKeyType"; } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public class ConceptDeclaration : Declaration { + public class ObjectMapKeyType : MapKeyType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.ConceptDeclaration"; - public bool isAbstract { get; set; } - public Identified identified { get; set; } - public TypeIdentifier superType { get; set; } - public Property[] properties { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ObjectMapKeyType"; + [JsonPropertyName("type")] + [NewtonsoftJson.JsonProperty("type")] + public TypeIdentifier type { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class BooleanMapvalueType : MapvalueType + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.BooleanMapvalueType"; } - public class AssetDeclaration : ConceptDeclaration { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DateTimeMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.AssetDeclaration"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DateTimeMapvalueType"; } - public class ParticipantDeclaration : ConceptDeclaration { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class StringMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.ParticipantDeclaration"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.StringMapvalueType"; } - public class TransactionDeclaration : ConceptDeclaration { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class IntegerMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.TransactionDeclaration"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.IntegerMapvalueType"; } - public class EventDeclaration : ConceptDeclaration { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class LongMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.EventDeclaration"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.LongMapvalueType"; } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class Property : Concept { + public class DoubleMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Property"; - public string name { get; set; } - public bool isArray { get; set; } - public bool isOptional { get; set; } - public Decorator[] decorators { get; set; } - public Range location { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DoubleMapvalueType"; } - public class RelationshipProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ObjectMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.RelationshipProperty"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ObjectMapvalueType"; + [JsonPropertyName("type")] + [NewtonsoftJson.JsonProperty("type")] public TypeIdentifier type { get; set; } } - public class ObjectProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class RelationshipMapvalueType : MapvalueType + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.ObjectProperty"; - public string defaultValue { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.RelationshipMapvalueType"; + [JsonPropertyName("type")] + [NewtonsoftJson.JsonProperty("type")] public TypeIdentifier type { get; set; } } - public class BooleanProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class EnumDeclaration : Declaration + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.BooleanProperty"; - public bool defaultValue { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.EnumDeclaration"; + [JsonPropertyName("properties")] + [NewtonsoftJson.JsonProperty("properties")] + public EnumProperty[] properties { get; set; } } - public class DateTimeProperty : Property { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DateTimeProperty"; + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class EnumProperty : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.EnumProperty"; + [System.ComponentModel.DataAnnotations.RegularExpression(@"^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$", ErrorMessage = "Invalid characters")] + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] + public string name { get; set; } + [JsonPropertyName("decorators")] + [NewtonsoftJson.JsonProperty("decorators")] + public Decorator?[] decorators { get; set; } + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } } - public class StringProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ConceptDeclaration : Declaration + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.StringProperty"; - public string defaultValue { get; set; } - public StringRegexValidator validator { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ConceptDeclaration"; + [JsonPropertyName("isAbstract")] + [NewtonsoftJson.JsonProperty("isAbstract")] + public bool isAbstract { get; set; } + [JsonPropertyName("identified")] + [NewtonsoftJson.JsonProperty("identified")] + public identified? identified { get; set; } + [JsonPropertyName("superType")] + [NewtonsoftJson.JsonProperty("superType")] + public TypeIdentifier? superType{ get; set; } + [JsonPropertyName("properties")] + [NewtonsoftJson.JsonProperty("properties")] + public Property[] properties { get; set; } } - public class StringRegexValidator : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class AssetDeclaration : ConceptDeclaration + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.StringRegexValidator"; - public string pattern { get; set; } - public string flags { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.AssetDeclaration"; } - public class DoubleProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ParticipantDeclaration : ConceptDeclaration + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DoubleProperty"; - public float defaultValue { get; set; } - public DoubleDomainValidator validator { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ParticipantDeclaration"; } - public class DoubleDomainValidator : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class TransactionDeclaration : ConceptDeclaration + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.DoubleDomainValidator"; - public float lower { get; set; } - public float upper { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.TransactionDeclaration"; } - public class IntegerProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class EventDeclaration : ConceptDeclaration + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.IntegerProperty"; - public int defaultValue { get; set; } - public IntegerDomainValidator validator { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.EventDeclaration"; + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public abstract class Property : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Property"; + [System.ComponentModel.DataAnnotations.RegularExpression(@"^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$", ErrorMessage = "Invalid characters")] + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] + public string name { get; set; } + [JsonPropertyName("isArray")] + [NewtonsoftJson.JsonProperty("isArray")] + public bool isArray { get; set; } + [JsonPropertyName("isOptional")] + [NewtonsoftJson.JsonProperty("isOptional")] + public bool isOptional { get; set; } + [JsonPropertyName("decorators")] + [NewtonsoftJson.JsonProperty("decorators")] + public Decorator?[] decorators { get; set; } + [JsonPropertyName("location")] + [NewtonsoftJson.JsonProperty("location")] + public Range? location { get; set; } } - public class IntegerDomainValidator : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class RelationshipProperty : Property + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.IntegerDomainValidator"; - public int lower { get; set; } - public int upper { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.RelationshipProperty"; + [JsonPropertyName("type")] + [NewtonsoftJson.JsonProperty("type")] + public TypeIdentifier type { get; set; } } - public class LongProperty : Property { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ObjectProperty : Property + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ObjectProperty"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public string? defaultValue { get; set; } + [JsonPropertyName("type")] + [NewtonsoftJson.JsonProperty("type")] + public TypeIdentifier type { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class BooleanProperty : Property + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.LongProperty"; - public long defaultValue { get; set; } - public LongDomainValidator validator { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.BooleanProperty"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public bool? defaultValue { get; set; } } - public class LongDomainValidator : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DateTimeProperty : Property + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.LongDomainValidator"; - public long lower { get; set; } - public long upper { get; set; } + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DateTimeProperty"; + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class StringProperty : Property + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.StringProperty"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public string? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public StringRegexValidator? validator { get; set; } + [JsonPropertyName("lengthValidator")] + [NewtonsoftJson.JsonProperty("lengthValidator")] + public StringLengthValidator? LengthValidator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class StringRegexValidator : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.StringRegexValidator"; + [JsonPropertyName("pattern")] + [NewtonsoftJson.JsonProperty("pattern")] + public string pattern { get; set; } + [JsonPropertyName("flags")] + [NewtonsoftJson.JsonProperty("flags")] + public string flags { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class StringLengthValidator : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.StringLengthValidator"; + [JsonPropertyName("minLength")] + [NewtonsoftJson.JsonProperty("minLength")] + public int? MinLength { get; set; } + [JsonPropertyName("maxLength")] + [NewtonsoftJson.JsonProperty("maxLength")] + public int? MaxLength { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DoubleProperty : Property + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DoubleProperty"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public float? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public DoubleDomainValidator? validator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DoubleDomainValidator : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DoubleDomainValidator"; + [JsonPropertyName("lower")] + [NewtonsoftJson.JsonProperty("lower")] + public float? lower { get; set; } + [JsonPropertyName("upper")] + [NewtonsoftJson.JsonProperty("upper")] + public float? upper { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class IntegerProperty : Property + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.IntegerProperty"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public int? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public IntegerDomainValidator? validator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class IntegerDomainValidator : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.IntegerDomainValidator"; + [JsonPropertyName("lower")] + [NewtonsoftJson.JsonProperty("lower")] + public int? lower { get; set; } + [JsonPropertyName("upper")] + [NewtonsoftJson.JsonProperty("upper")] + public int? upper { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class LongProperty : Property + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.LongProperty"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public long? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public LongDomainValidator? validator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class LongDomainValidator : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.LongDomainValidator"; + [JsonPropertyName("lower")] + [NewtonsoftJson.JsonProperty("lower")] + public long? lower { get; set; } + [JsonPropertyName("upper")] + [NewtonsoftJson.JsonProperty("upper")] + public long? upper { get; set; } } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class Import : Concept { + public abstract class Import : Concept + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Import"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Import"; [JsonPropertyName("namespace")] - [NewtonsoftJson.JsonProperty("namespace")] - public string _namespace { get; set; } - public string uri { get; set; } + [NewtonsoftJson.JsonProperty("namespace")] + public string _namespace { get; set; } + [JsonPropertyName("uri")] + [NewtonsoftJson.JsonProperty("uri")] + public string? uri { get; set; } } - public class ImportAll : Import { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ImportAll : Import + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.ImportAll"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ImportAll"; } - public class ImportType : Import { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ImportType : Import + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.ImportType"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ImportType"; + [JsonPropertyName("name")] + [NewtonsoftJson.JsonProperty("name")] public string name { get; set; } } - public class Model : Concept { + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class ImportTypes : Import + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Model"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ImportTypes"; + [JsonPropertyName("types")] + [NewtonsoftJson.JsonProperty("types")] + public string[] Types { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class Model : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Model"; [JsonPropertyName("namespace")] - [NewtonsoftJson.JsonProperty("namespace")] - public string _namespace { get; set; } - public string sourceUri { get; set; } - public string concertoVersion { get; set; } - public Import[] imports { get; set; } - public Declaration[] declarations { get; set; } - } - public class Models : Concept { - [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "concerto.metamodel.Models"; - public Model[] models { get; set; } + [NewtonsoftJson.JsonProperty("namespace")] + public string _namespace { get; set; } + [JsonPropertyName("sourceUri")] + [NewtonsoftJson.JsonProperty("sourceUri")] + public string? sourceUri { get; set; } + [JsonPropertyName("concertoVersion")] + [NewtonsoftJson.JsonProperty("concertoVersion")] + public string? concertoVersion { get; set; } + [JsonPropertyName("imports")] + [NewtonsoftJson.JsonProperty("imports")] + public Import?[] imports { get; set; } + [JsonPropertyName("declarations")] + [NewtonsoftJson.JsonProperty("declarations")] + public Declaration?[] declarations { get; set; } + [JsonPropertyName("decorators")] + [NewtonsoftJson.JsonProperty("decorators")] + public Decorator?[] decorators { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class Models : Concept + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.Models"; + [JsonPropertyName("models")] + [NewtonsoftJson.JsonProperty("models")] + public Model[] _Models { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public abstract class ScalarDeclaration : Declaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.ScalarDeclaration"; + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class BooleanScalar : ScalarDeclaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.BooleanScalar"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public bool? defaultValue { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class IntegerScalar : ScalarDeclaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.IntegerScalar"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public int? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public IntegerDomainValidator? validator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class LongScalar : ScalarDeclaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.LongScalar"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public long? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public LongDomainValidator? validator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DoubleScalar : ScalarDeclaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DoubleScalar"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public float? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public DoubleDomainValidator? validator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class StringScalar : ScalarDeclaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.StringScalar"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public string? defaultValue { get; set; } + [JsonPropertyName("validator")] + [NewtonsoftJson.JsonProperty("validator")] + public StringRegexValidator? validator { get; set; } + [JsonPropertyName("lengthValidator")] + [NewtonsoftJson.JsonProperty("lengthValidator")] + public StringLengthValidator? lengthValidator { get; set; } + } + [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] + public class DateTimeScalar : ScalarDeclaration + { + [JsonPropertyName("$class")] + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "concerto.metamodel@1.0.0.DateTimeScalar"; + [JsonPropertyName("defaultvalue")] + [NewtonsoftJson.JsonProperty("defaultvalue")] + public string? defaultValue { get; set; } } } diff --git a/ConcertoJsonConverter/models/concerto.metamodel.cto b/ConcertoJsonConverter/models/concerto.metamodel.cto index e09ce4c..1ae42b7 100644 --- a/ConcertoJsonConverter/models/concerto.metamodel.cto +++ b/ConcertoJsonConverter/models/concerto.metamodel.cto @@ -12,25 +12,21 @@ * limitations under the License. */ -namespace concerto.metamodel +@DotNetNamespace("AccordProject.Concerto.Metamodel") +namespace concerto.metamodel@1.0.0 -/** - * File location - */ concept Position { o Integer line o Integer column o Integer offset } + concept Range { o Position start o Position end o String source optional } -/** - * The metadmodel for Concerto files - */ concept TypeIdentifier { o String name o String namespace optional @@ -71,17 +67,54 @@ concept IdentifiedBy extends Identified { } abstract concept Declaration { - o String name regex=/^(?!null|true|false)(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u + o String name regex=/^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u + o Decorator[] decorators optional + o Range location optional +} + +abstract concept MapKeyType { o Decorator[] decorators optional o Range location optional } +abstract concept MapValueType { + o Decorator[] decorators optional + o Range location optional +} + +concept MapDeclaration extends Declaration { + o MapKeyType key + o MapValueType value +} + +concept StringMapKeyType extends MapKeyType {} +concept DateTimeMapKeyType extends MapKeyType {} + +concept ObjectMapKeyType extends MapKeyType { + o TypeIdentifier type +} + +concept BooleanMapValueType extends MapValueType {} +concept DateTimeMapValueType extends MapValueType {} +concept StringMapValueType extends MapValueType {} +concept IntegerMapValueType extends MapValueType {} +concept LongMapValueType extends MapValueType {} +concept DoubleMapValueType extends MapValueType {} + +concept ObjectMapValueType extends MapValueType { + o TypeIdentifier type +} + +concept RelationshipMapValueType extends MapValueType { + o TypeIdentifier type +} + concept EnumDeclaration extends Declaration { o EnumProperty[] properties } concept EnumProperty { - o String name regex=/^(?!null|true|false)(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u + o String name regex=/^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u o Decorator[] decorators optional o Range location optional } @@ -106,7 +139,7 @@ concept EventDeclaration extends ConceptDeclaration { } abstract concept Property { - o String name regex=/^(?!null|true|false)(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u + o String name regex=/^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u o Boolean isArray default=false o Boolean isOptional default=false o Decorator[] decorators optional @@ -132,6 +165,7 @@ concept DateTimeProperty extends Property { concept StringProperty extends Property { o String defaultValue optional o StringRegexValidator validator optional + o StringLengthValidator lengthValidator optional } concept StringRegexValidator { @@ -139,6 +173,11 @@ concept StringRegexValidator { o String flags } +concept StringLengthValidator { + o Integer minLength optional + o Integer maxLength optional +} + concept DoubleProperty extends Property { o Double defaultValue optional o DoubleDomainValidator validator optional @@ -181,14 +220,51 @@ concept ImportType extends Import { o String name } +concept ImportTypes extends Import { + o String[] types +} + concept Model { o String namespace o String sourceUri optional o String concertoVersion optional o Import[] imports optional o Declaration[] declarations optional + o Decorator[] decorators optional } concept Models { o Model[] models } + +abstract concept ScalarDeclaration extends Declaration { +} + +concept BooleanScalar extends ScalarDeclaration { + o Boolean defaultValue optional +} + +concept IntegerScalar extends ScalarDeclaration { + o Integer defaultValue optional + o IntegerDomainValidator validator optional +} + +concept LongScalar extends ScalarDeclaration { + o Long defaultValue optional + o LongDomainValidator validator optional +} + +concept DoubleScalar extends ScalarDeclaration { + o Double defaultValue optional + o DoubleDomainValidator validator optional +} + +concept StringScalar extends ScalarDeclaration { + o String defaultValue optional + o StringRegexValidator validator optional + o StringLengthValidator lengthValidator optional +} + +concept DateTimeScalar extends ScalarDeclaration { + o String defaultValue optional +} \ No newline at end of file diff --git a/ConcertoJsonConverter/org.test.cs b/ConcertoJsonConverter/org.test.cs index a78a4bb..84ca9d0 100644 --- a/ConcertoJsonConverter/org.test.cs +++ b/ConcertoJsonConverter/org.test.cs @@ -3,18 +3,21 @@ using Concerto.Serialization; using NewtonsoftJson = Newtonsoft.Json; using NewtonsoftConcerto = Concerto.Serialization.Newtonsoft; -namespace Concerto.Models.org.test { +namespace Concerto.Models.org.test +{ using Concerto.Models.concerto; [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public abstract class Person : Participant { + public abstract class Person : Participant + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "org.test.Person"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "org.test.Person"; public string email { get; set; } public string firstName { get; set; } public string lastName { get; set; } } - public enum Department { + public enum Department + { MARKETING, SALES, ENGINEERING, @@ -22,18 +25,20 @@ public enum Department { } [NewtonsoftJson.JsonConverter(typeof(NewtonsoftConcerto.ConcertoConverter))] - public class Employee : Person { + public class Employee : Person + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "org.test.Employee"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "org.test.Employee"; public Department? department { get; set; } public Employee manager { get; set; } public string employeeId { get; set; } } - public class Manager : Employee { + public class Manager : Employee + { [JsonPropertyName("$class")] - [NewtonsoftJson.JsonProperty("$class")] - public override string _class { get;} = "org.test.Manager"; + [NewtonsoftJson.JsonProperty("$class")] + public override string _class { get; } = "org.test.Manager"; public float budget { get; set; } } }