Skip to content

Commit

Permalink
Add 'decimal' schema type (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdouceur authored Oct 4, 2024
1 parent f3f02cc commit cb0b293
Show file tree
Hide file tree
Showing 857 changed files with 22,462 additions and 19,841 deletions.
2 changes: 2 additions & 0 deletions dotnet/src/DTDLParser/generated/ContextCollection.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,8 @@ private static ContextHistory GetDtdlContextHistory()
context4_0.AddTermDefinition("Date", new Dtmi("dtmi:dtdl:class:Date;4"), isMergeableType: false);
context4_0.AddTermDefinition("dateTime", new Dtmi("dtmi:dtdl:instance:Schema:dateTime;4"), isMergeableType: false);
context4_0.AddTermDefinition("DateTime", new Dtmi("dtmi:dtdl:class:DateTime;4"), isMergeableType: false);
context4_0.AddTermDefinition("decimal", new Dtmi("dtmi:dtdl:instance:Schema:decimal;4"), isMergeableType: false);
context4_0.AddTermDefinition("Decimal", new Dtmi("dtmi:dtdl:class:Decimal;4"), isMergeableType: false);
context4_0.AddTermDefinition("description", new Dtmi("dtmi:dtdl:property:description;4"), isMergeableType: false);
context4_0.AddTermDefinition("displayName", new Dtmi("dtmi:dtdl:property:displayName;4"), isMergeableType: false);
context4_0.AddTermDefinition("double", new Dtmi("dtmi:dtdl:instance:Schema:double;4"), isMergeableType: false);
Expand Down
1,889 changes: 1,889 additions & 0 deletions dotnet/src/DTDLParser/generated/DTDecimalInfo.g.cs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions dotnet/src/DTDLParser/generated/DTEntityInfo.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static DTEntityInfo()
ConcreteKinds[4].Add(DTEntityKind.Component);
ConcreteKinds[4].Add(DTEntityKind.Date);
ConcreteKinds[4].Add(DTEntityKind.DateTime);
ConcreteKinds[4].Add(DTEntityKind.Decimal);
ConcreteKinds[4].Add(DTEntityKind.Double);
ConcreteKinds[4].Add(DTEntityKind.Duration);
ConcreteKinds[4].Add(DTEntityKind.Enum);
Expand Down Expand Up @@ -2009,6 +2010,16 @@ internal static bool TryParseTypeStringV4(string typeString, Dtmi elementId, str
elementInfo.JsonLdElements[string.Empty] = elt;
materialKinds.Add(DTEntityKind.DateTime);
return true;
case "Decimal":
case "dtmi:dtdl:class:Decimal;4":
if (elementInfo == null)
{
elementInfo = new DTDecimalInfo(4, elementId, parentId, propName, definedIn);
}

elementInfo.JsonLdElements[string.Empty] = elt;
materialKinds.Add(DTEntityKind.Decimal);
return true;
case "Double":
case "dtmi:dtdl:class:Double;4":
if (elementInfo == null)
Expand Down
3 changes: 3 additions & 0 deletions dotnet/src/DTDLParser/generated/DTEntityKind.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public enum DTEntityKind
/// <summary>The kind of the Entity is DateTime.</summary>
DateTime,

/// <summary>The kind of the Entity is Decimal.</summary>
Decimal,

/// <summary>The kind of the Entity is Double.</summary>
Double,

Expand Down
3 changes: 2 additions & 1 deletion dotnet/src/DTDLParser/generated/DTNumericSchemaInfo.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static DTNumericSchemaInfo()

ConcreteKinds[4] = new HashSet<DTEntityKind>();
ConcreteKinds[4].Add(DTEntityKind.Byte);
ConcreteKinds[4].Add(DTEntityKind.Decimal);
ConcreteKinds[4].Add(DTEntityKind.Double);
ConcreteKinds[4].Add(DTEntityKind.Float);
ConcreteKinds[4].Add(DTEntityKind.Integer);
Expand All @@ -76,7 +77,7 @@ static DTNumericSchemaInfo()

BadTypeActionFormat[2] = "Use one of these standard values for property '{property}'{line1}: double, float, integer, long.";
BadTypeActionFormat[3] = "Use one of these standard values for property '{property}'{line1}: double, float, integer, long.";
BadTypeActionFormat[4] = "Use one of these standard values for property '{property}'{line1}: byte, double, float, integer, long, short, unsignedByte, unsignedInteger, unsignedLong, unsignedShort.";
BadTypeActionFormat[4] = "Use one of these standard values for property '{property}'{line1}: byte, decimal, double, float, integer, long, short, unsignedByte, unsignedInteger, unsignedLong, unsignedShort.";

BadTypeCauseFormat[2] = "{layer}{primaryId:p} property '{property}' has value{secondaryId:e} that is not a standard value for this property.";
BadTypeCauseFormat[3] = "{layer}{primaryId:p} property '{property}' has value{secondaryId:e} that is not a standard value for this property.";
Expand Down
3 changes: 2 additions & 1 deletion dotnet/src/DTDLParser/generated/DTPrimitiveSchemaInfo.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static DTPrimitiveSchemaInfo()
ConcreteKinds[4].Add(DTEntityKind.Bytes);
ConcreteKinds[4].Add(DTEntityKind.Date);
ConcreteKinds[4].Add(DTEntityKind.DateTime);
ConcreteKinds[4].Add(DTEntityKind.Decimal);
ConcreteKinds[4].Add(DTEntityKind.Double);
ConcreteKinds[4].Add(DTEntityKind.Duration);
ConcreteKinds[4].Add(DTEntityKind.Float);
Expand All @@ -95,7 +96,7 @@ static DTPrimitiveSchemaInfo()

BadTypeActionFormat[2] = "Use one of these standard values for property '{property}'{line1}: boolean, date, dateTime, double, duration, float, integer, long, string, time.";
BadTypeActionFormat[3] = "Use one of these standard values for property '{property}'{line1}: boolean, date, dateTime, double, duration, float, integer, long, string, time.";
BadTypeActionFormat[4] = "Use one of these standard values for property '{property}'{line1}: boolean, byte, bytes, date, dateTime, double, duration, float, integer, long, short, string, time, unsignedByte, unsignedInteger, unsignedLong, unsignedShort, uuid.";
BadTypeActionFormat[4] = "Use one of these standard values for property '{property}'{line1}: boolean, byte, bytes, date, dateTime, decimal, double, duration, float, integer, long, short, string, time, unsignedByte, unsignedInteger, unsignedLong, unsignedShort, uuid.";

BadTypeCauseFormat[2] = "{layer}{primaryId:p} property '{property}' has value{secondaryId:e} that is not a standard value for this property.";
BadTypeCauseFormat[3] = "{layer}{primaryId:p} property '{property}' has value{secondaryId:e} that is not a standard value for this property.";
Expand Down
3 changes: 2 additions & 1 deletion dotnet/src/DTDLParser/generated/DTSchemaInfo.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ static DTSchemaInfo()
ConcreteKinds[4].Add(DTEntityKind.Bytes);
ConcreteKinds[4].Add(DTEntityKind.Date);
ConcreteKinds[4].Add(DTEntityKind.DateTime);
ConcreteKinds[4].Add(DTEntityKind.Decimal);
ConcreteKinds[4].Add(DTEntityKind.Double);
ConcreteKinds[4].Add(DTEntityKind.Duration);
ConcreteKinds[4].Add(DTEntityKind.Enum);
Expand All @@ -106,7 +107,7 @@ static DTSchemaInfo()

BadTypeActionFormat[2] = "Provide a @type{line3} in the set of allowable types, or provide a value for property '{property}'{line1} with @type in the set of allowable types, or use one of these standard values for property '{property}'{line1}: boolean, date, dateTime, double, duration, float, integer, long, string, time.";
BadTypeActionFormat[3] = "Provide a @type{line3} in the set of allowable types, or provide a value for property '{property}'{line1} with @type in the set of allowable types, or use one of these standard values for property '{property}'{line1}: boolean, date, dateTime, double, duration, float, integer, long, string, time.";
BadTypeActionFormat[4] = "Provide a @type{line3} in the set of allowable types, or provide a value for property '{property}'{line1} with @type in the set of allowable types, or use one of these standard values for property '{property}'{line1}: boolean, byte, bytes, date, dateTime, double, duration, float, integer, long, short, string, time, unsignedByte, unsignedInteger, unsignedLong, unsignedShort, uuid.";
BadTypeActionFormat[4] = "Provide a @type{line3} in the set of allowable types, or provide a value for property '{property}'{line1} with @type in the set of allowable types, or use one of these standard values for property '{property}'{line1}: boolean, byte, bytes, date, dateTime, decimal, double, duration, float, integer, long, short, string, time, unsignedByte, unsignedInteger, unsignedLong, unsignedShort, uuid.";

BadTypeCauseFormat[2] = "{layer}{primaryId:p} property '{property}' has value{secondaryId:e} that does not have @type of Array, Enum, Map, or Object, and it is not a standard value for this property.";
BadTypeCauseFormat[3] = "{layer}{primaryId:p} property '{property}' has value{secondaryId:e} that does not have @type of Array, Enum, Map, or Object, and it is not a standard value for this property.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ static MaterialTypeNameCollection()
TypeNames.Add("dtmi:dtdl:class:DateTime;2");
TypeNames.Add("dtmi:dtdl:class:DateTime;3");
TypeNames.Add("dtmi:dtdl:class:DateTime;4");
TypeNames.Add("Decimal");
TypeNames.Add("dtmi:dtdl:class:Decimal;4");
TypeNames.Add("Double");
TypeNames.Add("dtmi:dtdl:class:Double;2");
TypeNames.Add("dtmi:dtdl:class:Double;3");
Expand Down
11 changes: 11 additions & 0 deletions dotnet/src/DTDLParser/generated/ModelElements.g.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,17 @@
},
"displayName": "unsignedShort"
},
{
"@context": "dtmi:dtdl:context;4",
"@id": "dtmi:dtdl:instance:Schema:decimal;4",
"@type": [
"Decimal"
],
"description": {
"en-US": "a string of decimal digits with an optional decimal point and fractional component"
},
"displayName": "decimal"
},
{
"@context": "dtmi:dtdl:context;4",
"@id": "dtmi:dtdl:instance:Schema:date;4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static SupplementalTypeCollection()
adjunctTypeInfoEV3.AllowedCotypeVersions = new HashSet<int>() { 2, 3 };

DTSupplementalTypeInfo adjunctTypeInfoEV4 = new DTSupplementalTypeInfo(DTExtensionKind.None, dtdlContextIdV4, adjunctTypeTypeIdEV4, isAbstract: true, isMergeable: false, null);
adjunctTypeInfoEV4.AllowedCotypeKinds = new HashSet<DTEntityKind>() { DTEntityKind.Array, DTEntityKind.Boolean, DTEntityKind.Byte, DTEntityKind.Bytes, DTEntityKind.Command, DTEntityKind.CommandPayload, DTEntityKind.CommandRequest, DTEntityKind.CommandResponse, DTEntityKind.CommandType, DTEntityKind.Component, DTEntityKind.Date, DTEntityKind.DateTime, DTEntityKind.Double, DTEntityKind.Duration, DTEntityKind.Enum, DTEntityKind.EnumValue, DTEntityKind.Field, DTEntityKind.Float, DTEntityKind.Integer, DTEntityKind.Interface, DTEntityKind.LatentType, DTEntityKind.Long, DTEntityKind.Map, DTEntityKind.MapKey, DTEntityKind.MapValue, DTEntityKind.NamedLatentType, DTEntityKind.Object, DTEntityKind.Property, DTEntityKind.Relationship, DTEntityKind.Short, DTEntityKind.String, DTEntityKind.Telemetry, DTEntityKind.Time, DTEntityKind.Unit, DTEntityKind.UnitAttribute, DTEntityKind.UnsignedByte, DTEntityKind.UnsignedInteger, DTEntityKind.UnsignedLong, DTEntityKind.UnsignedShort, DTEntityKind.Uuid };
adjunctTypeInfoEV4.AllowedCotypeKinds = new HashSet<DTEntityKind>() { DTEntityKind.Array, DTEntityKind.Boolean, DTEntityKind.Byte, DTEntityKind.Bytes, DTEntityKind.Command, DTEntityKind.CommandPayload, DTEntityKind.CommandRequest, DTEntityKind.CommandResponse, DTEntityKind.CommandType, DTEntityKind.Component, DTEntityKind.Date, DTEntityKind.DateTime, DTEntityKind.Decimal, DTEntityKind.Double, DTEntityKind.Duration, DTEntityKind.Enum, DTEntityKind.EnumValue, DTEntityKind.Field, DTEntityKind.Float, DTEntityKind.Integer, DTEntityKind.Interface, DTEntityKind.LatentType, DTEntityKind.Long, DTEntityKind.Map, DTEntityKind.MapKey, DTEntityKind.MapValue, DTEntityKind.NamedLatentType, DTEntityKind.Object, DTEntityKind.Property, DTEntityKind.Relationship, DTEntityKind.Short, DTEntityKind.String, DTEntityKind.Telemetry, DTEntityKind.Time, DTEntityKind.Unit, DTEntityKind.UnitAttribute, DTEntityKind.UnsignedByte, DTEntityKind.UnsignedInteger, DTEntityKind.UnsignedLong, DTEntityKind.UnsignedShort, DTEntityKind.Uuid };
adjunctTypeInfoEV4.AllowedCotypeVersions = new HashSet<int>() { 2, 3, 4 };

DTSupplementalTypeInfo aliasInfoEV3 = new DTSupplementalTypeInfo(DTExtensionKind.None, dtdlContextIdV3, aliasTypeIdEV3, isAbstract: false, isMergeable: false, null);
Expand All @@ -297,7 +297,7 @@ static SupplementalTypeCollection()

DTSupplementalTypeInfo aliasInfoEV4 = new DTSupplementalTypeInfo(DTExtensionKind.None, dtdlContextIdV4, aliasTypeIdEV4, isAbstract: false, isMergeable: false, null);
aliasInfoEV4.AddProperty("dtmi:dtdl:property:aliasFor;4", new Dtmi("dtmi:dtdl:class:Entity;4"), 1, 1, null, null, null, regex: null, hasUniqueValue: false, isPlural: false, isOptional: false, defaultLanguage: null, dtmiSeg: null, dictionaryKey: null, idRequired: false, typeRequired: true, childOf: null, instanceProperty: null, requiredValues: null, requiredValuesString: null, requiredLiteral: null);
aliasInfoEV4.AllowedCotypeKinds = new HashSet<DTEntityKind>() { DTEntityKind.Array, DTEntityKind.Boolean, DTEntityKind.Byte, DTEntityKind.Bytes, DTEntityKind.Command, DTEntityKind.CommandRequest, DTEntityKind.CommandResponse, DTEntityKind.CommandType, DTEntityKind.Component, DTEntityKind.Date, DTEntityKind.DateTime, DTEntityKind.Double, DTEntityKind.Duration, DTEntityKind.Enum, DTEntityKind.EnumValue, DTEntityKind.Field, DTEntityKind.Float, DTEntityKind.Integer, DTEntityKind.Interface, DTEntityKind.LatentType, DTEntityKind.Long, DTEntityKind.Map, DTEntityKind.MapKey, DTEntityKind.MapValue, DTEntityKind.NamedLatentType, DTEntityKind.Object, DTEntityKind.Property, DTEntityKind.Relationship, DTEntityKind.Short, DTEntityKind.String, DTEntityKind.Telemetry, DTEntityKind.Time, DTEntityKind.Unit, DTEntityKind.UnitAttribute, DTEntityKind.UnsignedByte, DTEntityKind.UnsignedInteger, DTEntityKind.UnsignedLong, DTEntityKind.UnsignedShort, DTEntityKind.Uuid };
aliasInfoEV4.AllowedCotypeKinds = new HashSet<DTEntityKind>() { DTEntityKind.Array, DTEntityKind.Boolean, DTEntityKind.Byte, DTEntityKind.Bytes, DTEntityKind.Command, DTEntityKind.CommandRequest, DTEntityKind.CommandResponse, DTEntityKind.CommandType, DTEntityKind.Component, DTEntityKind.Date, DTEntityKind.DateTime, DTEntityKind.Decimal, DTEntityKind.Double, DTEntityKind.Duration, DTEntityKind.Enum, DTEntityKind.EnumValue, DTEntityKind.Field, DTEntityKind.Float, DTEntityKind.Integer, DTEntityKind.Interface, DTEntityKind.LatentType, DTEntityKind.Long, DTEntityKind.Map, DTEntityKind.MapKey, DTEntityKind.MapValue, DTEntityKind.NamedLatentType, DTEntityKind.Object, DTEntityKind.Property, DTEntityKind.Relationship, DTEntityKind.Short, DTEntityKind.String, DTEntityKind.Telemetry, DTEntityKind.Time, DTEntityKind.Unit, DTEntityKind.UnitAttribute, DTEntityKind.UnsignedByte, DTEntityKind.UnsignedInteger, DTEntityKind.UnsignedLong, DTEntityKind.UnsignedShort, DTEntityKind.Uuid };
aliasInfoEV4.AllowedCotypeVersions = new HashSet<int>() { 4 };

DTSupplementalTypeInfo semanticTypeInfoEV2 = new DTSupplementalTypeInfo(DTExtensionKind.None, dtdlContextIdV2, semanticTypeTypeIdEV2, isAbstract: true, isMergeable: false, null);
Expand Down Expand Up @@ -741,7 +741,7 @@ static SupplementalTypeCollection()
DTSupplementalTypeInfo binaryUnitInfoCV2 = new DTSupplementalTypeInfo(DTExtensionKind.AdjunctType, dtdlExtensionQuantitativeTypesContextIdV2, binaryUnitTypeIdCV2, isAbstract: false, isMergeable: false, adjunctTypeTypeIdEV4);
binaryUnitInfoCV2.AddProperty("dtmi:dtdl:extension:quantitativeTypes:v2:property:baseUnit", new Dtmi("dtmi:dtdl:class:EnumValue;4"), 1, 1, null, null, null, regex: null, hasUniqueValue: false, isPlural: false, isOptional: false, defaultLanguage: null, dtmiSeg: null, dictionaryKey: null, idRequired: false, typeRequired: true, childOf: null, instanceProperty: null, requiredValues: null, requiredValuesString: null, requiredLiteral: null);
binaryUnitInfoCV2.AddProperty("dtmi:dtdl:extension:quantitativeTypes:v2:property:prefix", new Dtmi("dtmi:dtdl:class:EnumValue;4"), 1, null, null, null, null, regex: null, hasUniqueValue: false, isPlural: false, isOptional: true, defaultLanguage: null, dtmiSeg: null, dictionaryKey: null, idRequired: false, typeRequired: true, childOf: null, instanceProperty: null, requiredValues: null, requiredValuesString: null, requiredLiteral: null);
binaryUnitInfoCV2.AllowedCotypeKinds = new HashSet<DTEntityKind>() { DTEntityKind.Array, DTEntityKind.Boolean, DTEntityKind.Byte, DTEntityKind.Bytes, DTEntityKind.Command, DTEntityKind.CommandPayload, DTEntityKind.CommandRequest, DTEntityKind.CommandResponse, DTEntityKind.CommandType, DTEntityKind.Component, DTEntityKind.Date, DTEntityKind.DateTime, DTEntityKind.Double, DTEntityKind.Duration, DTEntityKind.Enum, DTEntityKind.EnumValue, DTEntityKind.Field, DTEntityKind.Float, DTEntityKind.Integer, DTEntityKind.Interface, DTEntityKind.LatentType, DTEntityKind.Long, DTEntityKind.Map, DTEntityKind.MapKey, DTEntityKind.MapValue, DTEntityKind.NamedLatentType, DTEntityKind.Object, DTEntityKind.Property, DTEntityKind.Relationship, DTEntityKind.Short, DTEntityKind.String, DTEntityKind.Telemetry, DTEntityKind.Time, DTEntityKind.Unit, DTEntityKind.UnitAttribute, DTEntityKind.UnsignedByte, DTEntityKind.UnsignedInteger, DTEntityKind.UnsignedLong, DTEntityKind.UnsignedShort, DTEntityKind.Uuid };
binaryUnitInfoCV2.AllowedCotypeKinds = new HashSet<DTEntityKind>() { DTEntityKind.Array, DTEntityKind.Boolean, DTEntityKind.Byte, DTEntityKind.Bytes, DTEntityKind.Command, DTEntityKind.CommandPayload, DTEntityKind.CommandRequest, DTEntityKind.CommandResponse, DTEntityKind.CommandType, DTEntityKind.Component, DTEntityKind.Date, DTEntityKind.DateTime, DTEntityKind.Decimal, DTEntityKind.Double, DTEntityKind.Duration, DTEntityKind.Enum, DTEntityKind.EnumValue, DTEntityKind.Field, DTEntityKind.Float, DTEntityKind.Integer, DTEntityKind.Interface, DTEntityKind.LatentType, DTEntityKind.Long, DTEntityKind.Map, DTEntityKind.MapKey, DTEntityKind.MapValue, DTEntityKind.NamedLatentType, DTEntityKind.Object, DTEntityKind.Property, DTEntityKind.Relationship, DTEntityKind.Short, DTEntityKind.String, DTEntityKind.Telemetry, DTEntityKind.Time, DTEntityKind.Unit, DTEntityKind.UnitAttribute, DTEntityKind.UnsignedByte, DTEntityKind.UnsignedInteger, DTEntityKind.UnsignedLong, DTEntityKind.UnsignedShort, DTEntityKind.Uuid };
binaryUnitInfoCV2.AllowedCotypeVersions = new HashSet<int>() { 2, 3, 4 };

DTSupplementalTypeInfo capacitanceInfoCV2 = new DTSupplementalTypeInfo(DTExtensionKind.SemanticType, dtdlExtensionQuantitativeTypesContextIdV2, capacitanceTypeIdCV2, isAbstract: false, isMergeable: false, quantitativeTypeTypeIdCV2);
Expand Down
1 change: 1 addition & 0 deletions dotnet/tests/ParserUnitTest/generated/ParserUnitTest.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public void TestParser_C(string testName)
[DataRow("DateTimeInstancesV2")]
[DataRow("DateTimeInstancesV3")]
[DataRow("DateTimeInstancesV4")]
[DataRow("DecimalInstancesV4")]
[DataRow("DetailedModelV2")]
[DataRow("DetailedModelV3")]
[DataRow("DetailedModelV4")]
Expand Down
Loading

0 comments on commit cb0b293

Please sign in to comment.