git.iko.soy/typeable/openapi3
on master help sign in
Add test for non-record product data type
f2e70e7Nickolay Kudasov
test/Data/Swagger/SchemaSpec.hs+18−1
@@ -18,8 +18,9 @@ checkToSchema proxy js = toSchema proxy <~> js
18
18
19spec :: Spec
19spec :: Spec
20spec = do
20spec = do
21− describe "Generic ToSchema" $
21+ describe "Generic ToSchema" $ do
22 context "Person" $ checkToSchema (Proxy :: Proxy Person) personSchemaJSON
22 context "Person" $ checkToSchema (Proxy :: Proxy Person) personSchemaJSON
23+ context "ISPair" $ checkToSchema (Proxy :: Proxy ISPair) ispairSchemaJSON
23
24
24main :: IO ()
25main :: IO ()
25main = hspec spec
26main = hspec spec
@@ -43,3 +44,19 @@ personSchemaJSON = [aesonQQ|
43 "required": ["name", "phone"]
44 "required": ["name", "phone"]
44}
45}
45|]
46|]
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+