servant-docs 0.11.8 → 0.11.9
raw patch · 5 files changed
+47/−10 lines, 5 filesdep ~basedep ~bytestring
Dependency ranges changed: base, bytestring
Files
- CHANGELOG.md +12/−0
- golden/comprehensive.md +2/−2
- servant-docs.cabal +5/−5
- src/Servant/Docs/Internal.hs +23/−1
- test/Servant/DocsSpec.hs +5/−2
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.9+------++### Significant changes++- Use Capture Description if available (#1423).++### Other changes++- Support GHC-9.0.1.+- Bump `bytestring` and `lens` dependencies.+ 0.11.8 ------
golden/comprehensive.md view
@@ -52,11 +52,11 @@ ``` -## GET /capture/:foo+## GET /capture/:bar ### Captures: -- *foo*: Capture foo Int+- *bar*: example description ### Response:
servant-docs.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: servant-docs-version: 0.11.8+version: 0.11.9 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.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1 extra-source-files: CHANGELOG.md@@ -41,8 +41,8 @@ -- -- note: mtl lower bound is so low because of GHC-7.8 build-depends:- base >= 4.9 && < 4.15- , bytestring >= 0.10.8.1 && < 0.11+ base >= 4.9 && < 4.16+ , bytestring >= 0.10.8.1 && < 0.12 , text >= 1.2.3.0 && < 1.3 -- Servant dependencies@@ -59,7 +59,7 @@ , hashable >= 1.2.7.0 && < 1.4 , http-media >= 0.7.1.3 && < 0.9 , http-types >= 0.12.2 && < 0.13- , lens >= 4.17 && < 4.20+ , lens >= 4.17 && < 5.1 , string-conversions >= 0.4.0.1 && < 0.5 , universe-base >= 1.1.1 && < 1.2 , unordered-containers >= 0.2.9.0 && < 0.3
src/Servant/Docs/Internal.hs view
@@ -862,7 +862,7 @@ -- | @"books" :> 'Capture' "isbn" Text@ will appear as -- @/books/:isbn@ in the docs. instance (KnownSymbol sym, ToCapture (Capture sym a), HasDocs api)- => HasDocs (Capture' mods sym a :> api) where+ => HasDocs (Capture' '[] sym a :> api) where docsFor Proxy (endpoint, action) = docsFor subApiP (endpoint', action')@@ -873,6 +873,28 @@ action' = over captures (|> toCapture captureP) action endpoint' = over path (\p -> p ++ [":" ++ symbolVal symP]) endpoint symP = Proxy :: Proxy sym++instance (KnownSymbol descr, KnownSymbol sym, HasDocs api)+ => HasDocs (Capture' (Description descr ': mods) sym a :> api) where++ docsFor Proxy (endpoint, action) =+ docsFor subApiP (endpoint', action')++ where subApiP = Proxy :: Proxy api++ docCapture = DocCapture (symbolVal symP) (symbolVal descrP)+ action' = over captures (|> docCapture) action+ endpoint' = over path (\p -> p ++ [":" ++ symbolVal symP]) endpoint+ descrP = Proxy :: Proxy descr+ symP = Proxy :: Proxy sym++instance {-# OVERLAPPABLE #-} HasDocs (Capture' mods sym a :> api)+ => HasDocs (Capture' (mod ': mods) sym a :> api) where++ docsFor Proxy =+ docsFor apiP++ where apiP = Proxy :: Proxy (Capture' mods sym a :> api) -- | @"books" :> 'CaptureAll' "isbn" Text@ will appear as
test/Servant/DocsSpec.hs view
@@ -126,8 +126,11 @@ it "mentions headers" $ do md `shouldContain` "- This endpoint is sensitive to the value of the **X-Test** HTTP header." - it "contains response samples" $- md `shouldContain` "{\"dt1field1\":\"field 1\",\"dt1field2\":13}"+ it "contains response samples - dt1field1" $+ md `shouldContain` "\"dt1field1\":\"field 1\""+ it "contains response samples - dt1field2" $+ md `shouldContain` "\"dt1field2\":13"+ it "contains request body samples" $ md `shouldContain` "17"