diff --git a/JsonSchema.Generation/Attributes/IfMaxAttribute.cs b/JsonSchema.Generation/Attributes/IfMaxAttribute.cs index 71689fef92..6ff1a782e7 100644 --- a/JsonSchema.Generation/Attributes/IfMaxAttribute.cs +++ b/JsonSchema.Generation/Attributes/IfMaxAttribute.cs @@ -52,7 +52,7 @@ public IfMaxAttribute(string propertyName, double value, object? group) { if (PropertyType == null) return null; - if (!PropertyType.IsNumber() && !PropertyType.IsNullableNumber()) + if (PropertyType.IsNumber() || PropertyType.IsNullableNumber()) { if (IsExclusive) return new ExclusiveMaximumIntent(Value.ClampToDecimal()); return new MaximumIntent(Value.ClampToDecimal()); diff --git a/JsonSchema.Generation/Attributes/IfMinAttribute.cs b/JsonSchema.Generation/Attributes/IfMinAttribute.cs index 359bd7d472..5a45eea3d2 100644 --- a/JsonSchema.Generation/Attributes/IfMinAttribute.cs +++ b/JsonSchema.Generation/Attributes/IfMinAttribute.cs @@ -52,7 +52,7 @@ public IfMinAttribute(string propertyName, double value, object? group) { if (PropertyType == null) return null; - if (!PropertyType.IsNumber() && !PropertyType.IsNullableNumber()) + if (PropertyType.IsNumber() || PropertyType.IsNullableNumber()) { if (IsExclusive) return new ExclusiveMinimumIntent(Value.ClampToDecimal()); return new MinimumIntent(Value.ClampToDecimal()); diff --git a/JsonSchema.Tests/SerializationTests.cs b/JsonSchema.Tests/SerializationTests.cs index 8b6c157da0..c0da637a2f 100644 --- a/JsonSchema.Tests/SerializationTests.cs +++ b/JsonSchema.Tests/SerializationTests.cs @@ -25,8 +25,8 @@ public class SerializationTests [TestCase("{\"additionalProperties\":true}")] [TestCase("{\"additionalProperties\":false}")] [TestCase("{\"additionalProperties\":{\"$id\":\"http://some.site/schema\"}}")] - [TestCase("{\"allOf\":[]}")] - [TestCase("{\"anyOf\":[]}")] + [TestCase("{\"allOf\":[{\"$id\":\"http://some.site/schema\"}]}")] + [TestCase("{\"anyOf\":[{\"$id\":\"http://some.site/schema\"}]}")] [TestCase("{\"const\":\"some text\"}")] [TestCase("{\"const\":9}")] [TestCase("{\"const\":9.0}")] @@ -74,7 +74,7 @@ public class SerializationTests [TestCase("{\"minProperties\":1}")] [TestCase("{\"multipleOf\":1}")] [TestCase("{\"not\":{\"$id\":\"http://some.site/schema\"}}")] - [TestCase("{\"oneOf\":[]}")] + [TestCase("{\"oneOf\":[{\"$id\":\"http://some.site/schema\"}]}")] [TestCase("{\"pattern\":\"^yes{1,3}$\"}")] [TestCase("{\"patternProperties\":{\"foo\":{}}}")] [TestCase("{\"prefixItems\":[{\"$id\":\"http://some.site/schema\"}]}")]