on 80fa574 help sign in
5 files changed+12−12
since splitsnapshots
unifiedsplit
schematic.cabal+2−2 src/Data/Schematic/JsonSchema.hs+4−5 src/Data/Schematic/Migration.hs+2−2 src/Data/Schematic/Path.hs+1 test/JsonSchemaSpec.hs+3−3
schematic.cabal+2−2
@@ -75,14 +75,14 @@ library
7575 , regex-tdfa
7676 , regex-tdfa-text
7777 , scientific
78− , singletons >= 2.4
78+ , singletons >= 2.3
7979 , smallcheck
8080 , tagged
8181 , template-haskell
8282 , text
8383 , union
8484 , unordered-containers
85− , validationt >= 0.2.1.0
85+ , validationt >= 0.2.0.0
8686 , vector
8787 , vinyl
8888 hs-source-dirs: src
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
src/Data/Schematic/Migration.hs+2−2
@@ -43,8 +43,8 @@ type family SchemaByKey (fs :: [(Symbol, Schema)]) (s :: Symbol) :: Schema where
4343 SchemaByKey ( '(a, s) ': tl) fn = SchemaByKey tl fn
4444
4545type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where
46− DeleteKey acc fn ('(fn, a) ': tl) = acc ++ tl
47− DeleteKey acc fn (fna ': tl) = acc ++ (fna ': tl)
46+ DeleteKey acc fn ('(fn, a) ': tl) = acc :++ tl
47+ DeleteKey acc fn (fna ': tl) = acc :++ (fna ': tl)
4848
4949type family UpdateKey
5050 (fn :: Symbol)
src/Data/Schematic/Path.hs+1
@@ -1,6 +1,7 @@
11module Data.Schematic.Path where
22
33import Data.Foldable as F
4+import Data.Monoid
45import Data.Singletons.Prelude
56import Data.Singletons.TypeLits
67import Data.Text as T
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"