@@ -2,24 +2,18 @@
22
33module SchemaSpec (spec, main) where
44
5−import Control.Monad
65import Data.ByteString.Lazy
76import Data.Aeson
87import Data.Proxy
98import Data.Schematic
10−import Data.Singletons
11−import Data.Singletons.Prelude
129import Data.Vinyl
1310import Test.Hspec
14−import Test.Hspec.SmallCheck
15−import Test.SmallCheck
16−import Test.SmallCheck.Series.Instances
1711
1812
1913type SchemaExample
2014 = 'SchemaObject
21− '[ '("foo", 'SchemaArray '[AEq 1] ('SchemaNumber '[NGt 10]))
22− , '("bar", 'SchemaOptional ('SchemaText '[TEnum '["foo", "bar"]]))]
15+ '[ '("foo", 'SchemaArray '[ 'AEq 1] ('SchemaNumber '[ 'NGt 10]))
16+ , '("bar", 'SchemaOptional ('SchemaText '[ 'TEnum '["foo", "bar"]]))]
2317
2418type TestMigration =
2519 'Migration "test_revision"
@@ -28,15 +22,6 @@ type TestMigration =
2822
2923type VS = 'Versioned SchemaExample '[ TestMigration ]
3024
31−exampleTest :: JsonRepr (SchemaOptional (SchemaText '[TEq 3]))
32−exampleTest = ReprOptional (Just (ReprText "lil"))
33−
34−exampleNumber :: JsonRepr (SchemaNumber '[NGt 10])
35−exampleNumber = ReprNumber 12
36−
37−exampleArray :: JsonRepr (SchemaArray '[AEq 1] (SchemaNumber '[NGt 10]))
38−exampleArray = ReprArray [exampleNumber]
39−
4025jsonExample :: JsonRepr SchemaExample
4126jsonExample = ReprObject $
4227 FieldRepr (ReprArray [ReprNumber 12])
@@ -49,9 +34,6 @@ schemaJson = "{\"foo\": [13], \"bar\": null}"
4934schemaJson2 :: ByteString
5035schemaJson2 = "{\"foo\": [3], \"bar\": null}"
5136
52−schemaJsonTopVersion :: ByteString
53−schemaJsonTopVersion = "{ \"foo\": 42, \"bar\": \"bar\" }"
54−
5537topObject
5638 :: JsonRepr
5739 ('SchemaObject
@@ -88,7 +70,7 @@ spec = do
8870 it "validates versioned json" $ do
8971 decodeAndValidateVersionedJson (Proxy @VS) schemaJson
9072 `shouldSatisfy` isValid
91− it "validates with Migration List" $ do
73+ it "validates versioned json with a migration list" $ do
9274 decodeAndValidateVersionedWithMList
9375 (Proxy @VS)
9476 ((:&&) (Proxy @(SchemaByRevision "test_revision" VS)) (const topObject) MNil)