Skip to content

Commit

Permalink
logic here isn't inverted; fix bad tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Mar 25, 2024
1 parent 4cf5eaf commit 101012e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion JsonSchema.Generation/Attributes/IfMaxAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion JsonSchema.Generation/Attributes/IfMinAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 3 additions & 3 deletions JsonSchema.Tests/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")]
Expand Down Expand Up @@ -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\"}]}")]
Expand Down

0 comments on commit 101012e

Please sign in to comment.