on master help sign in
2 files changed+8−7
since splitsnapshots
unifiedsplit
src/Data/Schematic/JsonSchema.hs+5−4 test/JsonSchemaSpec.hs+3−3
src/Data/Schematic/JsonSchema.hs+5−4
@@ -47,11 +47,12 @@ textConstraint (DTEnum ss) =
4747numberConstraint :: DemotedNumberConstraint -> State D4.Schema ()
4848numberConstraint (DNLe n) = modify $ \s -> s
4949 { _schemaMaximum = pure . fromIntegral $ n }
50−numberConstraint (DNLt n) =
51− let n' = if n == 0 then 0 else n - 1
52− in modify $ \s -> s { _schemaMaximum = pure . fromIntegral $ n' }
50+numberConstraint (DNLt n) = modify $ \s -> s
51+ { _schemaMaximum = pure . fromIntegral $ n
52+ , _schemaExclusiveMaximum = pure True }
5353numberConstraint (DNGt n) = modify $ \s -> s
54− { _schemaMinimum = pure . fromIntegral $ n + 1 }
54+ { _schemaMinimum = pure . fromIntegral $ n
55+ , _schemaExclusiveMinimum = pure True }
5556numberConstraint (DNGe n) = modify $ \s -> s
5657 { _schemaMinimum = pure . fromIntegral $ n }
5758numberConstraint (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" 2
79+ field @"n1" 1.1
8080 :& field @"n2" 1
81− :& field @"n3" 0
82− :& field @"n4" 1
81+ :& field @"n3" 0.9
82+ :& field @"n4" 1.0
8383 :& RNil
8484 fetchHTTPAndValidate schema (toJSON obj) >>= \case
8585 Left e -> fail "failed to validate test example"