Combine rendering of code samples for request/response bodies
This does mean that the "Example" portion for reqeust bodies is lost though.
This commit is contained in:
parent
4f8df0ebe2
commit
41d75b4de8
1 changed files with 6 additions and 3 deletions
|
@ -632,15 +632,18 @@ markdown api = unlines $
|
||||||
rqbodyStr types s =
|
rqbodyStr types s =
|
||||||
["#### Request:", ""]
|
["#### Request:", ""]
|
||||||
<> formatTypes types
|
<> formatTypes types
|
||||||
<> concatMap formatBody s
|
<> formatBodies s
|
||||||
|
|
||||||
formatTypes [] = []
|
formatTypes [] = []
|
||||||
formatTypes ts = ["- Supported content types are:", ""]
|
formatTypes ts = ["- Supported content types are:", ""]
|
||||||
<> map (\t -> " - `" <> show t <> "`") ts
|
<> map (\t -> " - `" <> show t <> "`") ts
|
||||||
<> [""]
|
<> [""]
|
||||||
|
|
||||||
|
formatBodies :: [(Text, M.MediaType, ByteString)] -> [String]
|
||||||
|
formatBodies = concatMap formatBody
|
||||||
|
|
||||||
formatBody (t, m, b) =
|
formatBody (t, m, b) =
|
||||||
"- Example (" <> cs t <> "): `" <> cs (show m) <> "`" :
|
"- " <> cs t <> " (`" <> cs (show m) <> "`):" :
|
||||||
contentStr m b
|
contentStr m b
|
||||||
|
|
||||||
markdownForType mime_type =
|
markdownForType mime_type =
|
||||||
|
@ -676,7 +679,7 @@ markdown api = unlines $
|
||||||
[] -> ["- No response body\n"]
|
[] -> ["- No response body\n"]
|
||||||
[("", t, r)] -> "- Response body as below." : contentStr t r
|
[("", t, r)] -> "- Response body as below." : contentStr t r
|
||||||
xs ->
|
xs ->
|
||||||
concatMap (\(ctx, t, r) -> ("- " <> T.unpack ctx <> " (`" <> cs (show t) <> "`)") : contentStr t r) xs
|
formatBodies xs
|
||||||
|
|
||||||
-- * Instances
|
-- * Instances
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue