@@ -30,13 +30,13 @@ textConstraint :: DemotedTextConstraint -> State D4.Schema ()
30textConstraint (DTEq n) = modify $ \s -> s
30textConstraint (DTEq n) = modify $ \s -> s
31 { _schemaMinLength = pure $ fromIntegral n
31 { _schemaMinLength = pure $ fromIntegral n
32 , _schemaMaxLength = pure $ fromIntegral n }
32 , _schemaMaxLength = pure $ fromIntegral n }
33+textConstraint (DTLt n) = modify $ \s -> s
34+ { _schemaMaxLength = pure . fromIntegral $ n + 1 }
33textConstraint (DTLe n) = modify $ \s -> s
35textConstraint (DTLe n) = modify $ \s -> s
34 { _schemaMaxLength = pure . fromIntegral $ n }
36 { _schemaMaxLength = pure . fromIntegral $ n }
35−textConstraint (DTLt n) =
37+textConstraint (DTGt n) =
36 let n' = if n == 0 then 0 else n - 1
38 let n' = if n == 0 then 0 else n - 1
37− in modify $ \s -> s { _schemaMaxLength = pure . fromIntegral $ n' }
39+ in modify $ \s -> s { _schemaMinLength = pure . fromIntegral $ n' }
38−textConstraint (DTGt n) = modify $ \s -> s
39− { _schemaMinLength = pure . fromIntegral $ n + 1 }
40textConstraint (DTGe n) = modify $ \s -> s
40textConstraint (DTGe n) = modify $ \s -> s
41 { _schemaMinLength = pure . fromIntegral $ n }
41 { _schemaMinLength = pure . fromIntegral $ n }
42textConstraint (DTRegex r) = modify $ \s -> s { _schemaPattern = pure r }
42textConstraint (DTRegex r) = modify $ \s -> s { _schemaPattern = pure r }
@@ -48,30 +48,18 @@ numberConstraint :: DemotedNumberConstraint -> State D4.Schema ()
48numberConstraint (DNLe n) = modify $ \s -> s
48numberConstraint (DNLe n) = modify $ \s -> s
49 { _schemaMaximum = pure . fromIntegral $ n }
49 { _schemaMaximum = pure . fromIntegral $ n }
50numberConstraint (DNLt n) = modify $ \s -> s
50numberConstraint (DNLt n) = modify $ \s -> s
51− { _schemaMaximum = pure . fromIntegral $ n
51+ { _schemaMaximum = pure . fromIntegral $ n + 1 }
52− , _schemaExclusiveMaximum = pure True }
53numberConstraint (DNGt n) = modify $ \s -> s
52numberConstraint (DNGt n) = modify $ \s -> s
54− { _schemaMinimum = pure . fromIntegral $ n
55− , _schemaExclusiveMinimum = pure True }
56−numberConstraint (DNGe n) = modify $ \s -> s
57 { _schemaMinimum = pure . fromIntegral $ n }
53 { _schemaMinimum = pure . fromIntegral $ n }
54+numberConstraint (DNGe n) =
55+ let n' = if n == 0 then 0 else n - 1
56+ in modify $ \s -> s { _schemaMinimum = pure . fromIntegral $ n' }
58numberConstraint (DNEq n) = modify $ \s -> s
57numberConstraint (DNEq n) = modify $ \s -> s
59 { _schemaMinimum = pure $ fromIntegral n
58 { _schemaMinimum = pure $ fromIntegral n
60 , _schemaMaximum = pure $ fromIntegral n }
59 , _schemaMaximum = pure $ fromIntegral n }
62arrayConstraint :: DemotedArrayConstraint -> State D4.Schema ()
61arrayConstraint :: DemotedArrayConstraint -> State D4.Schema ()
63−arrayConstraint (DALe n) = modify $ \s -> s
62+arrayConstraint (DAEq _) = pure ()
64− { _schemaMaxItems = pure . fromIntegral $ n }
65−arrayConstraint (DALt n) =
66− let n' = if n == 0 then 0 else n - 1
67− in modify $ \s -> s { _schemaMaxItems = pure . fromIntegral $ n' }
68−arrayConstraint (DAGt n) = modify $ \s -> s
69− { _schemaMinItems = pure . fromIntegral $ n + 1 }
70−arrayConstraint (DAGe n) = modify $ \s -> s
71− { _schemaMinItems = pure . fromIntegral $ n }
72−arrayConstraint (DAEq n) = modify $ \s -> s
73− { _schemaMinItems = pure $ fromIntegral n
74− , _schemaMaxItems = pure $ fromIntegral n }
76toJsonSchema
64toJsonSchema
77 :: forall proxy schema
65 :: forall proxy schema