git.iko.soy/typeable/swagger2
on master help sign in
Add test for non-record product data type
commitf2e70e7819fdcffa774ad1b1bacad86284f60c6a authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateMon 23 Nov 2015, 17:12 (11 years ago) parent581fb6c
1 file changed+18−1
test/Data/Swagger/SchemaSpec.hs+18−1
test/Data/Swagger/SchemaSpec.hs+18−1
@@ -18,8 +18,9 @@ checkToSchema proxy js = toSchema proxy <~> js
1818
1919spec :: Spec
2020spec = do
21− describe "Generic ToSchema" $
21+ describe "Generic ToSchema" $ do
2222 context "Person" $ checkToSchema (Proxy :: Proxy Person) personSchemaJSON
23+ context "ISPair" $ checkToSchema (Proxy :: Proxy ISPair) ispairSchemaJSON
2324
2425main :: IO ()
2526main = hspec spec
@@ -43,3 +44,19 @@ personSchemaJSON = [aesonQQ|
4344 "required": ["name", "phone"]
4445}
4546|]
47+
48+data ISPair = ISPair Integer String
49+ deriving (Generic, ToSchema)
50+
51+ispairSchemaJSON :: Value
52+ispairSchemaJSON = [aesonQQ|
53+{
54+ "type": "array",
55+ "items":
56+ [
57+ { "type": "integer" },
58+ { "type": "string" }
59+ ]
60+}
61+|]
62+