on master help sign in
schematic.cabal+2−2
since splitsnapshots
unifiedsplit
@@ -75,14 +75,14 @@ library
75 , regex-tdfa
75 , regex-tdfa
76 , regex-tdfa-text
76 , regex-tdfa-text
77 , scientific
77 , scientific
78− , singletons >= 2.3
78+ , singletons >= 2.4
79 , smallcheck
79 , smallcheck
80 , tagged
80 , tagged
81 , template-haskell
81 , template-haskell
82 , text
82 , text
83 , union
83 , union
84 , unordered-containers
84 , unordered-containers
85− , validationt >= 0.2.0.0
85+ , validationt >= 0.2.1.0
86 , vector
86 , vector
87 , vinyl
87 , vinyl
88 hs-source-dirs: src
88 hs-source-dirs: src
src/Data/Schematic/JsonSchema.hs+5−4
@@ -47,11 +47,12 @@ textConstraint (DTEnum ss) =
47numberConstraint :: DemotedNumberConstraint -> State D4.Schema ()
47numberConstraint :: 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 }
50−numberConstraint (DNLt n) =
50+numberConstraint (DNLt n) = modify $ \s -> s
51− let n' = if n == 0 then 0 else n - 1
52− in modify $ \s -> s { _schemaMaximum = pure . fromIntegral $ n' }
51+ { _schemaMaximum = pure . fromIntegral $ n
52+ , _schemaExclusiveMaximum = pure True }
53numberConstraint (DNGt n) = modify $ \s -> s
53numberConstraint (DNGt n) = modify $ \s -> s
54− { _schemaMinimum = pure . fromIntegral $ n + 1 }
54+ { _schemaMinimum = pure . fromIntegral $ n
55+ , _schemaExclusiveMinimum = pure True }
55numberConstraint (DNGe n) = modify $ \s -> s
56numberConstraint (DNGe n) = modify $ \s -> s
56 { _schemaMinimum = pure . fromIntegral $ n }
57 { _schemaMinimum = pure . fromIntegral $ n }
57numberConstraint (DNEq n) = modify $ \s -> s
58numberConstraint (DNEq n) = modify $ \s -> s
src/Data/Schematic/Migration.hs+2−2
@@ -43,8 +43,8 @@ type family SchemaByKey (fs :: [(Symbol, Schema)]) (s :: Symbol) :: Schema where
43 SchemaByKey ( '(a, s) ': tl) fn = SchemaByKey tl fn
43 SchemaByKey ( '(a, s) ': tl) fn = SchemaByKey tl fn
44
44
45type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where
45type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where
46− DeleteKey acc fn ('(fn, a) ': tl) = acc :++ tl
46+ DeleteKey acc fn ('(fn, a) ': tl) = acc ++ tl
47− DeleteKey acc fn (fna ': tl) = acc :++ (fna ': tl)
47+ DeleteKey acc fn (fna ': tl) = acc ++ (fna ': tl)
48
48
49type family UpdateKey
49type family UpdateKey
50 (fn :: Symbol)
50 (fn :: Symbol)
src/Data/Schematic/Path.hs−1
@@ -1,7 +1,6 @@
1module Data.Schematic.Path where
1module Data.Schematic.Path where
2
2
3import Data.Foldable as F
3import Data.Foldable as F
4−import Data.Monoid
5import Data.Singletons.Prelude
4import Data.Singletons.Prelude
6import Data.Singletons.TypeLits
5import Data.Singletons.TypeLits
7import Data.Text as T
6import Data.Text as T
test/JsonSchemaSpec.hs+3−3
@@ -76,10 +76,10 @@ spec = do
76 let
76 let
77 schema = D4.SchemaWithURI (fromJust $ toJsonSchema (Proxy @SchemaNumberExample)) Nothing
77 schema = D4.SchemaWithURI (fromJust $ toJsonSchema (Proxy @SchemaNumberExample)) Nothing
78 obj = withRepr @SchemaNumberExample $
78 obj = withRepr @SchemaNumberExample $
79− field @"n1" 2
79+ field @"n1" 1.1
80 :& field @"n2" 1
80 :& field @"n2" 1
81− :& field @"n3" 0
81+ :& field @"n3" 0.9
82− :& field @"n4" 1
82+ :& field @"n4" 1.0
83 :& RNil
83 :& RNil
84 fetchHTTPAndValidate schema (toJSON obj) >>= \case
84 fetchHTTPAndValidate schema (toJSON obj) >>= \case
85 Left e -> fail "failed to validate test example"
85 Left e -> fail "failed to validate test example"