servant-docs 0.12 → 0.13
raw patch · 4 files changed
+48/−10 lines, 4 filesdep ~basedep ~base-compatdep ~bytestring
Dependency ranges changed: base, base-compat, bytestring, lens, servant, text
Files
- CHANGELOG.md +9/−0
- golden/comprehensive.md +18/−0
- servant-docs.cabal +9/−9
- src/Servant/Docs/Internal.hs +12/−1
CHANGELOG.md view
@@ -1,6 +1,15 @@ [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.13+----++- WithResource combinator for Servant-managed resources. [#1630](https://github.com/haskell-servant/servant/pull/1630)++ For servant-docs, this meant the addition of `instance HasDocs api => HasDocs (WithResource res :> api)`++- Compatibility with GHC series 9.2, 9.4, 9.6+ 0.12 ----
golden/comprehensive.md view
@@ -530,6 +530,24 @@ ``` +## GET /resource++### Response:++- Status code 200+- Headers: []++- Supported content types are:++ - `application/json;charset=utf-8`+ - `application/json`++- Example (`application/json;charset=utf-8`, `application/json`):++```javascript++```+ ## GET /streaming ### Request:
servant-docs.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: servant-docs-version: 0.12+version: 0.13 synopsis: generate API docs for your servant webservice category: Servant, Web@@ -19,7 +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.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1+tested-with: GHC==8.6.5, GHC==8.8.4, GHC ==8.10.7, GHC ==9.0.2, GHC ==9.2.7, GHC ==9.4.4 extra-source-files: CHANGELOG.md@@ -41,25 +41,25 @@ -- -- note: mtl lower bound is so low because of GHC-7.8 build-depends:- base >= 4.9 && < 4.16+ base >= 4.9 && < 4.19 , bytestring >= 0.10.8.1 && < 0.12- , text >= 1.2.3.0 && < 1.3+ , text >= 1.2.3.0 && < 2.1 -- Servant dependencies build-depends:- servant >= 0.18 && <0.20+ servant >= 0.20 && <0.21 -- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Here can be exceptions if we really need features from the newer versions. build-depends: aeson >= 1.4.1.0 && < 3 , aeson-pretty >= 0.8.5 && < 0.9- , base-compat >= 0.10.5 && < 0.12+ , base-compat >= 0.10.5 && < 0.14 , case-insensitive >= 1.2.0.11 && < 1.3- , hashable >= 1.2.7.0 && < 1.4+ , hashable >= 1.2.7.0 && < 1.5 , http-media >= 0.7.1.3 && < 0.9 , http-types >= 0.12.2 && < 0.13- , lens >= 4.17 && < 5.1+ , lens >= 4.17 && < 5.3 , string-conversions >= 0.4.0.1 && < 0.5 , universe-base >= 1.1.1 && < 1.2 , unordered-containers >= 0.2.9.0 && < 0.3@@ -105,4 +105,4 @@ tasty >= 1.1.0.4 && < 1.5, tasty-golden >= 2.3.2 && < 2.4, tasty-hunit >= 0.10.0.1 && < 0.11,- transformers >= 0.5.2.0 && < 0.6+ transformers >= 0.5.2.0 && < 0.7
src/Servant/Docs/Internal.hs view
@@ -61,7 +61,9 @@ import GHC.TypeLits import Servant.API import Servant.API.ContentTypes+import Servant.API.TypeErrors import Servant.API.TypeLevel+import Servant.API.Generic import qualified Data.Universe.Helpers as U @@ -446,7 +448,7 @@ & apiEndpoints %~ HM.unionWith (flip combineAction) endpoints --- | Generate the docs for a given API that implements 'HasDocs' with with any+-- | Generate the docs for a given API that implements 'HasDocs' with any -- number of introduction(s) docsWithIntros :: HasDocs api => [DocIntro] -> Proxy api -> API docsWithIntros intros = docsWith defaultDocOptions intros mempty@@ -1143,12 +1145,21 @@ instance HasDocs api => HasDocs (WithNamedContext name context api) where docsFor Proxy = docsFor (Proxy :: Proxy api) +instance HasDocs api => HasDocs (WithResource res :> api) where+ docsFor Proxy = docsFor (Proxy :: Proxy api)+ instance (ToAuthInfo (BasicAuth realm usr), HasDocs api) => HasDocs (BasicAuth realm usr :> api) where docsFor Proxy (endpoint, action) = docsFor (Proxy :: Proxy api) (endpoint, action') where authProxy = Proxy :: Proxy (BasicAuth realm usr) action' = over authInfo (|> toAuthInfo authProxy) action++instance+ ( HasDocs (ToServantApi api)+ , ErrorIfNoGeneric api+ ) => HasDocs (NamedRoutes api) where+ docsFor Proxy = docsFor (Proxy :: Proxy (ToServantApi api)) -- ToSample instances for simple types instance ToSample NoContent