git.iko.soy/typeable/servant
on master help sign in
Fix servant-docs test suite and add Headers to TestApi
5aa0e2eNickolay Kudasov
servant-docs/test/Servant/DocsSpec.hs+7−7
@@ -30,7 +30,7 @@ spec = describe "Servant.Docs" $ do
30 describe "markdown with extra info" $ do
30 describe "markdown with extra info" $ do
31 let
31 let
32 extra = extraInfo
32 extra = extraInfo
33− (Proxy :: Proxy (Get '[JSON, PlainText] Int))
33+ (Proxy :: Proxy (Get '[JSON, PlainText] (Headers '[Header "Location" String] Int)))
34 (defAction & notes <>~ [DocNote "Get an Integer" ["get an integer in Json or plain text"]])
34 (defAction & notes <>~ [DocNote "Get an Integer" ["get an integer in Json or plain text"]])
35 <>
35 <>
36 extraInfo
36 extraInfo
@@ -90,26 +90,26 @@ data Datatype1 = Datatype1 { dt1field1 :: String
90
90
91instance ToJSON Datatype1
91instance ToJSON Datatype1
92
92
93−instance ToSample Datatype1 Datatype1 where
93+instance ToSample Datatype1 where
94 toSamples _ = singleSample $ Datatype1 "field 1" 13
94 toSamples _ = singleSample $ Datatype1 "field 1" 13
95
95
96−instance ToSample Char Char where
96+instance ToSample Char where
97 toSamples _ = samples ['a'..'z']
97 toSamples _ = samples ['a'..'z']
98
98
99−instance ToSample Int Int where
99+instance ToSample Int where
100 toSamples _ = singleSample 17
100 toSamples _ = singleSample 17
101
101
102instance MimeRender PlainText Int where
102instance MimeRender PlainText Int where
103 mimeRender _ = cs . show
103 mimeRender _ = cs . show
104
104
105−type TestApi1 = Get '[JSON, PlainText] Int
105+type TestApi1 = Get '[JSON, PlainText] (Headers '[Header "Location" String] Int)
106 :<|> ReqBody '[JSON] String :> Post '[JSON] Datatype1
106 :<|> ReqBody '[JSON] String :> Post '[JSON] Datatype1
107
107
108data TT = TT1 | TT2 deriving (Show, Eq)
108data TT = TT1 | TT2 deriving (Show, Eq)
109data UT = UT1 | UT2 deriving (Show, Eq)
109data UT = UT1 | UT2 deriving (Show, Eq)
110
110
111−instance ToSample TT TT where
111+instance ToSample TT where
112 toSamples _ = [("eins", TT1), ("zwei", TT2)]
112 toSamples _ = [("eins", TT1), ("zwei", TT2)]
113
113
114−instance ToSample UT UT where
114+instance ToSample UT where
115 toSamples _ = [("yks", UT1), ("kaks", UT2)]
115 toSamples _ = [("yks", UT1), ("kaks", UT2)]