packages feed

servant-docs 0.10 → 0.10.0.1

raw patch · 4 files changed

+19/−10 lines, 4 filesdep ~servantPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: servant

API changes (from Hackage documentation)

+ Servant.Docs.Internal: instance Servant.Docs.Internal.HasDocs Servant.API.Empty.EmptyAPI
- Servant.Docs: rqbody :: Lens' Action [(MediaType, ByteString)]
+ Servant.Docs: rqbody :: Lens' Action [(Text, MediaType, ByteString)]
- Servant.Docs.Internal: Action :: [DocAuthentication] -> [DocCapture] -> [Text] -> [DocQueryParam] -> [DocNote] -> [(String, [DocQueryParam])] -> [MediaType] -> [(MediaType, ByteString)] -> Response -> Action
+ Servant.Docs.Internal: Action :: [DocAuthentication] -> [DocCapture] -> [Text] -> [DocQueryParam] -> [DocNote] -> [(String, [DocQueryParam])] -> [MediaType] -> [(Text, MediaType, ByteString)] -> Response -> Action
- Servant.Docs.Internal: [_rqbody] :: Action -> [(MediaType, ByteString)]
+ Servant.Docs.Internal: [_rqbody] :: Action -> [(Text, MediaType, ByteString)]
- Servant.Docs.Internal: rqbody :: Lens' Action [(MediaType, ByteString)]
+ Servant.Docs.Internal: rqbody :: Lens' Action [(Text, MediaType, ByteString)]

Files

README.md view
@@ -19,7 +19,7 @@  import Data.Proxy import Data.Text-import Servant+import Servant.Docs  -- our type for a Greeting message data Greet = Greet { _msg :: Text }
servant-docs.cabal view
@@ -1,5 +1,5 @@ name:                servant-docs-version:             0.10+version:             0.10.0.1 synopsis:            generate API docs for your servant webservice description:   Library for generating API docs from a servant API definition.@@ -42,7 +42,7 @@     , http-media >= 0.6     , http-types >= 0.7     , lens-    , servant == 0.10.*+    , servant == 0.11.*     , string-conversions     , text     , unordered-containers
src/Servant/Docs/Internal.hs view
@@ -249,7 +249,7 @@   , _notes    :: [DocNote]                   -- user supplied   , _mxParams :: [(String, [DocQueryParam])] -- type collected + user supplied info   , _rqtypes  :: [M.MediaType]               -- type collected-  , _rqbody   :: [(M.MediaType, ByteString)] -- user supplied+  , _rqbody   :: [(Text, M.MediaType, ByteString)] -- user supplied   , _response :: Response                    -- user supplied   } deriving (Eq, Ord, Show) @@ -618,7 +618,7 @@            where values = param ^. paramValues -        rqbodyStr :: [M.MediaType] -> [(M.MediaType, ByteString)]-> [String]+        rqbodyStr :: [M.MediaType] -> [(Text, M.MediaType, ByteString)]-> [String]         rqbodyStr [] [] = []         rqbodyStr types s =             ["#### Request:", ""]@@ -630,8 +630,8 @@             <> map (\t -> "    - `" <> show t <> "`") ts             <> [""] -        formatBody (m, b) =-          "- Example: `" <> cs (show m) <> "`" :+        formatBody (t, m, b) =+          "- Example (" <> cs t <> "): `" <> cs (show m) <> "`" :           contentStr m b          markdownForType mime_type =@@ -683,6 +683,10 @@           p2 :: Proxy b           p2 = Proxy +-- | The generated docs for @'EmptyAPI'@ are empty.+instance HasDocs EmptyAPI where+  docsFor Proxy _ _ = emptyAPI+ -- | @"books" :> 'Capture' "isbn" Text@ will appear as -- @/books/:isbn@ in the docs. instance (KnownSymbol sym, ToCapture (Capture sym a), HasDocs api)@@ -801,11 +805,12 @@ instance (ToSample a, AllMimeRender (ct ': cts) a, HasDocs api)       => HasDocs (ReqBody (ct ': cts) a :> api) where -  docsFor Proxy (endpoint, action) =-    docsFor subApiP (endpoint, action')+  docsFor Proxy (endpoint, action) opts@DocOptions{..} =+    docsFor subApiP (endpoint, action') opts      where subApiP = Proxy :: Proxy api-          action' = action & rqbody .~ sampleByteString t p+          action' :: Action+          action' = action & rqbody .~ take _maxSamples (sampleByteStrings t p)                            & rqtypes .~ allMime t           t = Proxy :: Proxy (ct ': cts)           p = Proxy :: Proxy a
test/Servant/DocsSpec.hs view
@@ -104,7 +104,10 @@     it "contains request body samples" $       md `shouldContain` "17" +    it "does not generate any docs mentioning the 'empty-api' path" $+      md `shouldNotContain` "empty-api" + -- * APIs  data Datatype1 = Datatype1 { dt1field1 :: String@@ -128,6 +131,7 @@ type TestApi1 = Get '[JSON, PlainText] (Headers '[Header "Location" String] Int)            :<|> ReqBody '[JSON] String :> Post '[JSON] Datatype1            :<|> Header "X-Test" Int :> Put '[JSON] Int+           :<|> "empty-api" :> EmptyAPI  data TT = TT1 | TT2 deriving (Show, Eq) data UT = UT1 | UT2 deriving (Show, Eq)