packages feed

servant-docs 0.4.0 → 0.4.1

raw patch · 3 files changed

+7/−6 lines, 3 files

Files

README.md view
@@ -32,7 +32,7 @@  -- We can also implement 'MimeRender' explicitly for additional formats. instance MimeRender PlainText Greet where-    toByteString Proxy (Greet s) = "<h1>" <> cs s <> "</h1>"+    mimeRender Proxy (Greet s) = "<h1>" <> cs s <> "</h1>"  -- we provide a sample value for the 'Greet' type instance ToSample Greet where@@ -56,7 +56,7 @@ type TestApi =        "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get '[JSON,PlainText] Greet   :<|> "greet" :> RQBody '[JSON] Greet :> Post '[JSON] Greet-  :<|> "delete" :> Capture "greetid" Text :> Delete+  :<|> "delete" :> Capture "greetid" Text :> Delete '[] ()  testApi :: Proxy TestApi testApi = Proxy
servant-docs.cabal view
@@ -1,5 +1,5 @@ name:                servant-docs-version:             0.4.0+version:             0.4.1 synopsis:            generate API docs for your servant webservice description:   Library for generating API docs from a servant API definition.
src/Servant/Docs.hs view
@@ -30,6 +30,7 @@ -- > {-# LANGUAGE OverloadedStrings     #-} -- > {-# LANGUAGE TypeOperators         #-} -- > {-# OPTIONS_GHC -fno-warn-orphans #-}+-- > import Control.Lens -- > import Data.Aeson -- > import Data.Proxy -- > import Data.String.Conversions@@ -51,7 +52,7 @@ -- > -- > -- | We can also implement 'MimeRender' for additional formats like 'PlainText'. -- > instance MimeRender PlainText Greet where--- >     toByteString Proxy (Greet s) = "\"" <> cs s <> "\""+-- >     mimeRender Proxy (Greet s) = "\"" <> cs s <> "\"" -- > -- > -- We add some useful annotations to our captures, -- > -- query parameters and request body to make the docs@@ -111,7 +112,7 @@ -- >   :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet -- > -- >        -- DELETE /greet/:greetid--- >   :<|> "greet" :> Capture "greetid" Text :> Delete+-- >   :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] () -- > -- > testApi :: Proxy TestApi -- > testApi = Proxy@@ -121,7 +122,7 @@ -- > -- notes. -- > extra :: ExtraInfo TestApi -- > extra =--- >     extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $+-- >     extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] ())) $ -- >              defAction & headers <>~ ["unicorns"] -- >                        & notes   <>~ [ DocNote "Title" ["This is some text"] -- >                                      , DocNote "Second secton" ["And some more"]