git.iko.soy/typeable/servant
on master help sign in
removed Servant.Docs.printMarkdown
commit102c752268ae301f6d81580f2984f5363f8b64d4 authorSönke Hahn <soenke.hahn@zalora.com> dateFri 14 Nov 2014, 19:54 (12 years ago) parent49c301d
2 files changed+9−12
example/greet.hs+1−1 src/Servant/Docs.hs+8−11
example/greet.hs+1−1
@@ -102,4 +102,4 @@ main = do
102102 print =<< runEitherT (deleteGreet "blah" uri)
103103 killThread tid
104104 putStrLn "\n---------\n"
105− printMarkdown docsGreet
105+ putStrLn $ markdown docsGreet
src/Servant/Docs.hs+8−11
@@ -16,13 +16,13 @@
1616--
1717-- @docs :: 'HasDocs' api => 'Proxy' api -> 'API'@
1818--
19−-- You can then call 'printMarkdown' on it:
19+-- You can then call 'markdown' on it:
2020--
21−-- @printMarkdown :: 'API' -> IO ()@
21+-- @printMarkdown :: 'API' -> String@
2222--
2323-- or define a custom pretty printer:
2424--
25−-- @yourPrettyDocs :: 'API' -> IO () -- or blaze-html's HTML, or ...@
25+-- @yourPrettyDocs :: 'API' -> String -- or blaze-html's HTML, or ...@
2626--
2727-- The only thing you'll need to do will be to implement some classes
2828-- for your captures, get parameters and request or response bodies.
@@ -70,7 +70,7 @@
7070-- > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove"
7171-- >
7272-- > -- API specification
73−-- > type TestApi =
73+-- > type TestApi =
7474-- > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
7575-- > :<|> "greet" :> RQBody Greet :> Post Greet
7676-- > :<|> "delete" :> Capture "greetid" Text :> Delete
@@ -83,10 +83,10 @@
8383-- > greetDocs = docs testApi
8484-- >
8585-- > main :: IO ()
86−-- > main = printMarkdown greetDocs
86+-- > main = putStrLn $ markdown greetDocs
8787module Servant.Docs
8888 ( -- * 'HasDocs' class and key functions
89− HasDocs(..), docs, markdown, printMarkdown
89+ HasDocs(..), docs, markdown
9090
9191 , -- * Classes you need to implement for your types
9292 ToSample(..)
@@ -355,11 +355,8 @@ class ToParam t where
355355class ToCapture c where
356356 toCapture :: Proxy c -> DocCapture
357357
358−-- | Print documentation in Markdown format for
359−-- the given 'API', on standard output.
360−printMarkdown :: API -> IO ()
361−printMarkdown = print . markdown
362−
358+-- | Generate documentation in Markdown format for
359+-- the given 'API'.
363360markdown :: API -> String
364361markdown = unlines . concat . map (uncurry printEndpoint) . HM.toList
365362