on 7c6b2ec help sign in
2 files changed+7−8
since splitsnapshots
unifiedsplit
src/Data/Schematic/JsonSchema.hs+4−5 test/JsonSchemaSpec.hs+3−3
src/Data/Schematic/JsonSchema.hs+4−5
@@ -47,12 +47,11 @@ textConstraint (DTEnum ss) =
4747numberConstraint :: DemotedNumberConstraint -> State D4.Schema ()
4848numberConstraint (DNLe n) = modify $ \s -> s
4949 { _schemaMaximum = pure . fromIntegral $ n }
50−numberConstraint (DNLt n) = modify $ \s -> s
51− { _schemaMaximum = pure . fromIntegral $ n
52− , _schemaExclusiveMaximum = pure True }
50+numberConstraint (DNLt n) =
51+ let n' = if n == 0 then 0 else n - 1
52+ in modify $ \s -> s { _schemaMaximum = pure . fromIntegral $ n' }
5353numberConstraint (DNGt n) = modify $ \s -> s
54− { _schemaMinimum = pure . fromIntegral $ n
55− , _schemaExclusiveMinimum = pure True }
54+ { _schemaMinimum = pure . fromIntegral $ n + 1 }
5655numberConstraint (DNGe n) = modify $ \s -> s
5756 { _schemaMinimum = pure . fromIntegral $ n }
5857numberConstraint (DNEq n) = modify $ \s -> s
test/JsonSchemaSpec.hs+3−3
@@ -76,10 +76,10 @@ spec = do
7676 let
7777 schema = D4.SchemaWithURI (fromJust $ toJsonSchema (Proxy @SchemaNumberExample)) Nothing
7878 obj = withRepr @SchemaNumberExample $
79− field @"n1" 1.1
79+ field @"n1" 2
8080 :& field @"n2" 1
81− :& field @"n3" 0.9
82− :& field @"n4" 1.0
81+ :& field @"n3" 0
82+ :& field @"n4" 1
8383 :& RNil
8484 fetchHTTPAndValidate schema (toJSON obj) >>= \case
8585 Left e -> fail "failed to validate test example"