packages feed

servant-docs 0.11.6 → 0.11.7

raw patch · 4 files changed

+59/−19 lines, 4 filesnew-uploader

Files

CHANGELOG.md view
@@ -1,6 +1,18 @@ [The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md) [Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md) +0.11.7+------++### Significant changes++- Add instance for ToSample NonEmpty++### Other changes++- Bump "tested-with" ghc versions+- Fix servant-docs code sample in README+ 0.11.5 ---- 
README.md view
@@ -2,24 +2,56 @@  ![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png) -Generate API docs for your *servant* webservice. Feel free to also take a look at [servant-pandoc](https://github.com/mpickering/servant-pandoc) which uses this package to target a broad range of output formats using the excellent **pandoc**.+Generate API docs for your _servant_ webservice. Feel free to also take a look at [servant-pandoc](https://github.com/mpickering/servant-pandoc) which uses this package to target a broad range of output formats using the excellent **pandoc**.  ## Example  See [here](https://github.com/haskell-servant/servant/blob/master/servant-docs/example/greet.md) for the output of the following program. -``` haskell+```haskell {-# LANGUAGE DataKinds #-}-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} -import Data.Proxy-import Data.Text+import Data.Aeson (FromJSON, ToJSON)+import Data.Proxy (Proxy (..))+import Data.String.Conversions (cs)+import Data.Text (Text)+import GHC.Generics (Generic)+import Servant.API+  ( (:<|>),+    (:>),+    Capture,+    Delete,+    Get,+    JSON,+    MimeRender,+    PlainText,+    Post,+    QueryParam,+    ReqBody,+    mimeRender,+  ) import Servant.Docs+  ( API,+    DocCapture (..),+    DocQueryParam (..),+    ParamKind (..),+    ToCapture,+    ToParam,+    ToSample,+    docs,+    markdown,+    singleSample,+    toCapture,+    toParam,+    toSamples,+  )  -- our type for a Greeting message data Greet = Greet { _msg :: Text }@@ -29,6 +61,7 @@ -- 'MimeRender' instance for 'JSON'. instance FromJSON Greet instance ToJSON Greet+instance ToSample ()  -- We can also implement 'MimeRender' explicitly for additional formats. instance MimeRender PlainText Greet where@@ -36,8 +69,7 @@  -- we provide a sample value for the 'Greet' type instance ToSample Greet where-  toSample = Just g-+  toSamples _ = singleSample g     where g = Greet "Hello, haskeller!"  instance ToParam (QueryParam "capital" Bool) where@@ -45,6 +77,7 @@     DocQueryParam "capital"                   ["true", "false"]                   "Get the greeting message in uppercase (true) or not (false). Default is false."+                  Normal  instance ToCapture (Capture "name" Text) where   toCapture _ = DocCapture "name" "name of the person to greet"@@ -55,8 +88,8 @@ -- API specification 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 '[] ()+  :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet+  :<|> "delete" :> Capture "greetid" Text :> Delete '[JSON] ()  testApi :: Proxy TestApi testApi = Proxy
servant-docs.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                servant-docs-version:             0.11.6+version:             0.11.7  synopsis:            generate API docs for your servant webservice category:            Servant, Web@@ -19,13 +19,7 @@ maintainer:          haskell-servant-maintainers@googlegroups.com copyright:           2014-2016 Zalora South East Asia Pte Ltd, 2016-2019 Servant Contributors build-type:          Simple-tested-with:-  GHC ==8.0.2-   || ==8.2.2-   || ==8.4.4-   || ==8.6.5-   || ==8.8.3-   || ==8.10.1+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2  extra-source-files:   CHANGELOG.md
src/Servant/Docs/Internal.hs view
@@ -1064,6 +1064,7 @@ instance ToSample a => ToSample (Maybe a) instance (ToSample a, ToSample b) => ToSample (Either a b) instance ToSample a => ToSample [a]+instance ToSample a => ToSample (NonEmpty a)  -- ToSample instances for Control.Applicative types instance ToSample a => ToSample (Const a b)