@@ -1,64 +1,10 @@
1name: servant-docs
1name: servant-docs
2−version: 0.2
2+version: 0.2.1
3synopsis: generate API docs for your servant webservice
3synopsis: generate API docs for your servant webservice
4description:
4description:
5 Library for generating API docs from a servant API definition.
5 Library for generating API docs from a servant API definition.
7− Runnable example below that prints API docs in markdown.
7+ Runnable example <https://github.com/haskell-servant/servant-docs/blob/master/example/greet.hs here>.
9− > {-# LANGUAGE DataKinds #-}
10− > {-# LANGUAGE PolyKinds #-}
11− > {-# LANGUAGE TypeFamilies #-}
12− > {-# LANGUAGE DeriveGeneric #-}
13− > {-# LANGUAGE TypeOperators #-}
14− > {-# LANGUAGE FlexibleInstances #-}
15− > {-# LANGUAGE OverloadedStrings #-}
21− > -- our type for a Greeting message
22− > data Greet = Greet { _msg :: Text }
23− > deriving (Generic, Show)
25− > -- we get our JSON serialization for free
26− > instance FromJSON Greet
27− > instance ToJSON Greet
29− > -- we provide a sample value for the 'Greet' type
30− > instance ToSample Greet where
33− > where g = Greet "Hello, haskeller!"
35− > instance ToParam (QueryParam "capital" Bool) where
37− > DocQueryParam "capital"
39− > "Get the greeting message in uppercase (true) or not (false). Default is false."
41− > instance ToCapture (Capture "name" Text) where
42− > toCapture _ = DocCapture "name" "name of the person to greet"
44− > instance ToCapture (Capture "greetid" Text) where
45− > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove"
47− > -- API specification
49− > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
50− > :<|> "greet" :> RQBody Greet :> Post Greet
51− > :<|> "delete" :> Capture "greetid" Text :> Delete
53− > testApi :: Proxy TestApi
56− > -- Generate the Documentation's ADT
58− > greetDocs = docs testApi
61− > main = putStrLn $ markdown greetDocs
62license: BSD3
8license: BSD3
63license-file: LICENSE
9license-file: LICENSE
64author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
10author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
@@ -83,7 +29,7 @@ library
83 , bytestring
29 , bytestring
84 , hashable
30 , hashable
86− , servant >= 0.2
32+ , servant >= 0.2.1
87 , string-conversions
33 , string-conversions
88 , system-filepath
34 , system-filepath