@@ -1,64 +1,10 @@
11name: servant-docs
2−version: 0.2
2+version: 0.2.1
33synopsis: generate API docs for your servant webservice
44description:
55 Library for generating API docs from a servant API definition.
66 .
7− Runnable example below that prints API docs in markdown.
8− .
9− > {-# LANGUAGE DataKinds #-}
10− > {-# LANGUAGE PolyKinds #-}
11− > {-# LANGUAGE TypeFamilies #-}
12− > {-# LANGUAGE DeriveGeneric #-}
13− > {-# LANGUAGE TypeOperators #-}
14− > {-# LANGUAGE FlexibleInstances #-}
15− > {-# LANGUAGE OverloadedStrings #-}
16− >
17− > import Data.Proxy
18− > import Data.Text
19− > import Servant
20− >
21− > -- our type for a Greeting message
22− > data Greet = Greet { _msg :: Text }
23− > deriving (Generic, Show)
24− >
25− > -- we get our JSON serialization for free
26− > instance FromJSON Greet
27− > instance ToJSON Greet
28− >
29− > -- we provide a sample value for the 'Greet' type
30− > instance ToSample Greet where
31− > toSample = Just g
32− >
33− > where g = Greet "Hello, haskeller!"
34− >
35− > instance ToParam (QueryParam "capital" Bool) where
36− > toParam _ =
37− > DocQueryParam "capital"
38− > ["true", "false"]
39− > "Get the greeting message in uppercase (true) or not (false). Default is false."
40− >
41− > instance ToCapture (Capture "name" Text) where
42− > toCapture _ = DocCapture "name" "name of the person to greet"
43− >
44− > instance ToCapture (Capture "greetid" Text) where
45− > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove"
46− >
47− > -- API specification
48− > type TestApi =
49− > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
50− > :<|> "greet" :> RQBody Greet :> Post Greet
51− > :<|> "delete" :> Capture "greetid" Text :> Delete
52− >
53− > testApi :: Proxy TestApi
54− > testApi = Proxy
55− >
56− > -- Generate the Documentation's ADT
57− > greetDocs :: API
58− > greetDocs = docs testApi
59− >
60− > main :: IO ()
61− > main = putStrLn $ markdown greetDocs
7+ Runnable example <https://github.com/haskell-servant/servant-docs/blob/master/example/greet.hs here>.
628license: BSD3
639license-file: LICENSE
6410author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
@@ -83,7 +29,7 @@ library
8329 , bytestring
8430 , hashable
8531 , lens
86− , servant >= 0.2
32+ , servant >= 0.2.1
8733 , string-conversions
8834 , system-filepath
8935 , text