servant-docs 0.12 → 0.13.1
raw patch · 5 files changed
Files
- CHANGELOG.md +14/−0
- example/greet.hs +1/−2
- golden/comprehensive.md +46/−28
- servant-docs.cabal +11/−11
- src/Servant/Docs/Internal.hs +13/−2
CHANGELOG.md view
@@ -1,6 +1,20 @@ [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.1+------++- Compatibility with newer dependencies and newer GHCs.++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 ----
example/greet.hs view
@@ -9,8 +9,7 @@ import Data.Aeson import Data.Proxy import Data.String.Conversions-import Data.Text- (Text)+import Data.Text (Text) import GHC.Generics import Servant.API import Servant.Docs
golden/comprehensive.md view
@@ -12,7 +12,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -30,7 +30,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -48,7 +48,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -70,7 +70,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -92,7 +92,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -114,7 +114,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -135,7 +135,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -160,7 +160,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -178,7 +178,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -200,7 +200,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -218,7 +218,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json 17 ``` @@ -240,7 +240,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -262,7 +262,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -280,7 +280,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -298,7 +298,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -316,7 +316,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -341,7 +341,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -366,7 +366,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -392,7 +392,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -410,7 +410,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json 17 ``` @@ -446,7 +446,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -461,7 +461,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json 17 ``` @@ -477,7 +477,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -492,7 +492,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json 17 ``` @@ -508,7 +508,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -526,10 +526,28 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` +## 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`):++```json++```+ ## GET /streaming ### Request:@@ -568,7 +586,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ``` @@ -586,7 +604,7 @@ - Example (`application/json;charset=utf-8`, `application/json`): -```javascript+```json ```
servant-docs.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: servant-docs-version: 0.12+version: 0.13.1 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.10.7, GHC ==9.0.2, GHC ==9.2.8, GHC ==9.4.8, GHC ==9.6.4, GHC ==9.8.2, GHC ==9.10.1 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- , bytestring >= 0.10.8.1 && < 0.12- , text >= 1.2.3.0 && < 1.3+ base >= 4.14 && < 4.21+ , bytestring >= 0.10.8.1 && < 0.13+ , text >= 1.2.3.0 && < 2.2 -- Servant dependencies build-depends:- servant >= 0.18 && <0.20+ servant >= 0.20.2 && <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.15 , case-insensitive >= 1.2.0.11 && < 1.3- , hashable >= 1.2.7.0 && < 1.4+ , hashable >= 1.2.7.0 && < 1.6 , http-media >= 0.7.1.3 && < 0.9 , http-types >= 0.12.2 && < 0.13- , lens >= 4.17 && < 5.1+ , lens >= 4.17 && < 5.4 , string-conversions >= 0.4.0.1 && < 0.5 , universe-base >= 1.1.1 && < 1.2 , unordered-containers >= 0.2.9.0 && < 0.3@@ -102,7 +102,7 @@ -- Additional dependencies build-depends:- tasty >= 1.1.0.4 && < 1.5,+ tasty >= 1.1.0.4 && < 1.6, 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@@ -812,7 +814,7 @@ ("text", "html") -> "html" ("application", "xml") -> "xml" ("text", "xml") -> "xml"- ("application", "json") -> "javascript"+ ("application", "json") -> "json" ("application", "javascript") -> "javascript" ("text", "css") -> "css" (_, _) -> ""@@ -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