From a2f8c2c9b40f029cf3e2abd40d300e94cc2a1f77 Mon Sep 17 00:00:00 2001 From: Robert Soeldner Date: Sat, 29 Sep 2018 17:49:06 +0200 Subject: [PATCH 1/2] Fix markdown code indent, drop unused var --- servant-docs/src/Servant/Docs/Internal.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/servant-docs/src/Servant/Docs/Internal.hs b/servant-docs/src/Servant/Docs/Internal.hs index 452176c5..42fb4f61 100644 --- a/servant-docs/src/Servant/Docs/Internal.hs +++ b/servant-docs/src/Servant/Docs/Internal.hs @@ -760,9 +760,9 @@ markdownWith RenderingOptions{..} api = unlines $ contentStr mime_type body = "" : - " ```" <> markdownForType mime_type : + "```" <> markdownForType mime_type : cs body : - " ```" : + "```" : "" : [] @@ -866,7 +866,6 @@ instance {-# OVERLAPPABLE #-} t = Proxy :: Proxy '[ct] method' = reflectMethod (Proxy :: Proxy method) status = fromInteger $ natVal (Proxy :: Proxy status) - p = Proxy :: Proxy a instance {-# OVERLAPPING #-} (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status From 4e5e0a5324de0af279ce2ef9825b3a9e206a9b86 Mon Sep 17 00:00:00 2001 From: Robert Soeldner Date: Sat, 29 Sep 2018 17:50:23 +0200 Subject: [PATCH 2/2] Update example output --- servant-docs/example/greet.md | 59 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/servant-docs/example/greet.md b/servant-docs/example/greet.md index 67e1a666..322d3c28 100644 --- a/servant-docs/example/greet.md +++ b/servant-docs/example/greet.md @@ -10,34 +10,42 @@ You'll also note that multiple intros are possible. ## POST /greet -#### Request: +### Request: - Supported content types are: + - `application/json;charset=utf-8` - `application/json` -- Example: `application/json` +- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`): ```javascript "HELLO, HASKELLER" ``` -#### Response: +- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`): -- Status code 201 +```javascript +"Hello, haskeller" +``` + +### Response: + +- Status code 200 - Headers: [("X-Example","1729")] - Supported content types are: + - `application/json;charset=utf-8` - `application/json` -- If you use ?capital=true +- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`): ```javascript "HELLO, HASKELLER" ``` -- If you use ?capital=false +- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`): ```javascript "Hello, haskeller" @@ -45,81 +53,70 @@ You'll also note that multiple intros are possible. ## DELETE /greet/:greetid -#### Title +### Title This is some text -#### Second secton +### Second secton And some more -#### Captures: +### Captures: - *greetid*: identifier of the greet msg to remove +### Headers: - This endpoint is sensitive to the value of the **unicorns** HTTP header. -#### Response: +### Response: - Status code 200 - Headers: [] - Supported content types are: + - `application/json;charset=utf-8` - `application/json` -- Response body as below. +- Example (`application/json;charset=utf-8`, `application/json`): ```javascript -[] + ``` ## GET /hello/:name -#### Captures: +### Captures: - *name*: name of the person to greet -#### GET Parameters: +### GET Parameters: - capital - **Values**: *true, false* - **Description**: Get the greeting message in uppercase (true) or not (false).Default is false. -#### Response: +### Response: - Status code 200 - Headers: [] - Supported content types are: + - `application/json;charset=utf-8` - `application/json` - `text/plain;charset=utf-8` -- If you use ?capital=true +- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`, `text/plain;charset=utf-8`): ```javascript "HELLO, HASKELLER" ``` -- If you use ?capital=true - -``` -"HELLO, HASKELLER" -``` - -- If you use ?capital=false +- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`): ```javascript "Hello, haskeller" ``` - -- If you use ?capital=false - -``` -"Hello, haskeller" -``` - -