git.iko.soy/typeable/servant
on master help sign in
Handle request/response bodies with empty titles
commited3ace3066824c5c9485954311dc58233dc14fe6 authorIvan Lazar Miljenovic <Ivan.Miljenovic@gmail.com> dateFri 6 Oct 2017, 13:19 (9 years ago) parenta21bead
1 file changed+5−1
servant-docs/src/Servant/Docs/Internal.hs+5−1
servant-docs/src/Servant/Docs/Internal.hs+5−1
@@ -719,11 +719,15 @@ markdownWith RenderingOptions{..} api = unlines $
719719
720720 formatBody :: (Text, NonEmpty M.MediaType, ByteString) -> [String]
721721 formatBody (t, ms, b) =
722− "- " <> cs t <> " (" <> mediaList ms <> "):" :
722+ "- " <> title <> " (" <> mediaList ms <> "):" :
723723 contentStr (NE.head ms) b
724724 where
725725 mediaList = fold . NE.intersperse ", " . fmap (\m -> "`" ++ show m ++ "`")
726726
727+ title
728+ | T.null t = "Example"
729+ | otherwise = cs t
730+
727731 markdownForType mime_type =
728732 case (M.mainType mime_type, M.subType mime_type) of
729733 ("text", "html") -> "html"