diff --git a/ApiDoctor.Validation/ExtensionMethods.cs b/ApiDoctor.Validation/ExtensionMethods.cs index 34cf270a..160f952b 100644 --- a/ApiDoctor.Validation/ExtensionMethods.cs +++ b/ApiDoctor.Validation/ExtensionMethods.cs @@ -463,6 +463,9 @@ public static SimpleDataType ParseSimpleTypeString(string lowercaseString) case "double": simpleType = SimpleDataType.Double; break; + case "decimal": + simpleType = SimpleDataType.Decimal; + break; case "float": simpleType = SimpleDataType.Float; break; diff --git a/ApiDoctor.Validation/OData/ExtensionMethods.cs b/ApiDoctor.Validation/OData/ExtensionMethods.cs index cbc3c56c..64a68ce7 100644 --- a/ApiDoctor.Validation/OData/ExtensionMethods.cs +++ b/ApiDoctor.Validation/OData/ExtensionMethods.cs @@ -46,6 +46,7 @@ public static class ExtensionMethods { "Edm.DateTimeOffset", SimpleDataType.DateTimeOffset }, { "Edm.Duration", SimpleDataType.Duration }, { "Edm.Double", SimpleDataType.Double }, + { "Edm.Decimal", SimpleDataType.Decimal }, { "Edm.Float", SimpleDataType.Float }, { "Edm.Guid", SimpleDataType.Guid }, { "Edm.TimeOfDay", SimpleDataType.TimeOfDay}, diff --git a/ApiDoctor.Validation/ParameterDataType.cs b/ApiDoctor.Validation/ParameterDataType.cs index 1db26887..d08b7cc7 100644 --- a/ApiDoctor.Validation/ParameterDataType.cs +++ b/ApiDoctor.Validation/ParameterDataType.cs @@ -297,10 +297,12 @@ internal bool JsonLooksDifferentFrom(ParameterDataType type) type.Type != SimpleDataType.Int16 && type.Type != SimpleDataType.Int32 && type.Type != SimpleDataType.Int64; + case SimpleDataType.Decimal: case SimpleDataType.Double: case SimpleDataType.Float: case SimpleDataType.Single: return + type.Type != SimpleDataType.Decimal && type.Type != SimpleDataType.Double && type.Type != SimpleDataType.Float && type.Type != SimpleDataType.Single; @@ -374,7 +376,7 @@ We should never allow something from one tree to be considered less specific tha { return true; } - else if (this.Type == SimpleDataType.Double && (type.Type == SimpleDataType.Float)) + else if (this.Type == SimpleDataType.Decimal && (type.Type == SimpleDataType.Double || type.Type == SimpleDataType.Float)) { return true; } @@ -418,6 +420,7 @@ static ParameterDataType() GenericObject = new ParameterDataType(SimpleDataType.Object); GenericCollection = new ParameterDataType(SimpleDataType.Object, true); Boolean = new ParameterDataType(SimpleDataType.Boolean); + Decimal = new ParameterDataType(SimpleDataType.Decimal); Double = new ParameterDataType(SimpleDataType.Double); Float = new ParameterDataType(SimpleDataType.Float); Guid = new ParameterDataType(SimpleDataType.Guid); @@ -440,6 +443,10 @@ public static ParameterDataType GenericCollection get; private set; } public static ParameterDataType Boolean + { + get; private set; + } + public static ParameterDataType Decimal { get; private set; } @@ -493,6 +500,7 @@ public enum SimpleDataType Float, Double, + Decimal, Date, DateTimeOffset, diff --git a/ApiDoctor.Validation/ParameterDefinition.cs b/ApiDoctor.Validation/ParameterDefinition.cs index f74f54d0..677688a0 100644 --- a/ApiDoctor.Validation/ParameterDefinition.cs +++ b/ApiDoctor.Validation/ParameterDefinition.cs @@ -90,6 +90,7 @@ public JToken ToExampleJToken() return new JValue(DateTime.Now.ToString("yyyy-MM-dd")); case SimpleDataType.DateTimeOffset: return new JValue(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")); + case SimpleDataType.Decimal: case SimpleDataType.Double: case SimpleDataType.Float: case SimpleDataType.Single: