@@ -95,7 +95,7 @@ module Servant.Docs
9595 , Endpoint, path, method, defEndpoint
9696 , API, emptyAPI
9797 , DocCapture(..), capSymbol, capDesc
98− , DocQueryParam(..), paramName, paramValues, paramDesc
98+ , DocQueryParam(..), ParamKind(..), paramName, paramValues, paramDesc, paramKind
9999 , Response, respStatus, respBody, defResponse
100100 , Action, captures, params, rqbody, response, defAction
101101 , single
@@ -199,8 +199,17 @@ data DocQueryParam = DocQueryParam
199199 { _paramName :: String -- type supplied
200200 , _paramValues :: [String] -- user supplied
201201 , _paramDesc :: String -- user supplied
202+ , _paramKind :: ParamKind
202203 } deriving (Eq, Show)
203204
205+-- | Type of GET parameter:
206+--
207+-- - Normal corresponds to @QueryParam@, i.e your usual GET parameter
208+-- - List corresponds to @QueryParams@, i.e GET parameters with multiple values
209+-- - Flag corresponds to @QueryFlag@, i.e a value-less GET parameter
210+data ParamKind = Normal | List | Flag
211+ deriving (Eq, Show)
212+
204213-- | A type to represent an HTTP response. Has an 'Int' status and
205214-- a 'Maybe ByteString' response body. Tweak 'defResponse' using
206215-- the 'respStatus' and 'respBody' lenses if you want.
@@ -373,9 +382,14 @@ printMarkdown = imapM_ printEndpoint
373382 putStrLn ""
374383 paramStr param = do
375384 putStrLn $ " - " ++ param ^. paramName
376− when (not $ null values) $
385+ when (not (null values) || param ^. paramKind /= Flag) $
377386 putStrLn $ " - **Values**: *" ++ intercalate ", " values ++ "*"
378387 putStrLn $ " - **Description**: " ++ param ^. paramDesc
388+ when (param ^. paramKind == List) $
389+ putStrLn $ " - This parameter is a **list**. All GET parameters with the name "
390+ ++ param ^. paramName ++ "[] will forward their values in a list to the handler."
391+ when (param ^. paramKind == Flag) $
392+ putStrLn $ " - This parameter is a **flag**. This means no value is expected to be associated to this parameter."
379393
380394 where values = param ^. paramValues
381395