Document the type of endpoint a parameter belongs to

Closes #760
This commit is contained in:
Ivan Lazar Miljenovic 2017-07-28 16:31:55 +10:00
parent 213620e56a
commit 89e0a98ac5

View file

@ -529,14 +529,16 @@ markdown api = unlines $
authStr (action ^. authInfo) ++
capturesStr (action ^. captures) ++
headersStr (action ^. headers) ++
paramsStr (action ^. params) ++
paramsStr meth (action ^. params) ++
rqbodyStr (action ^. rqtypes) (action ^. rqbody) ++
responseStr (action ^. response) ++
[]
where str = "## " ++ BSC.unpack (endpoint^.method)
where str = "## " ++ BSC.unpack meth
++ " " ++ showPath (endpoint^.path)
meth = endpoint ^. method
introsStr :: [DocIntro] -> [String]
introsStr = concatMap introStr
@ -593,23 +595,23 @@ markdown api = unlines $
where headerStr hname = "- This endpoint is sensitive to the value of the **"
++ unpack hname ++ "** HTTP header."
paramsStr :: [DocQueryParam] -> [String]
paramsStr [] = []
paramsStr l =
"#### GET Parameters:" :
paramsStr :: HTTP.Method -> [DocQueryParam] -> [String]
paramsStr _ [] = []
paramsStr m l =
("#### " ++ cs m ++ " Parameters:") :
"" :
map paramStr l ++
map (paramStr m) l ++
"" :
[]
paramStr param = unlines $
paramStr m param = unlines $
("- " ++ param ^. paramName) :
(if (not (null values) || param ^. paramKind /= Flag)
then [" - **Values**: *" ++ intercalate ", " values ++ "*"]
else []) ++
(" - **Description**: " ++ param ^. paramDesc) :
(if (param ^. paramKind == List)
then [" - This parameter is a **list**. All GET parameters with the name "
then [" - This parameter is a **list**. All " ++ cs m ++ " parameters with the name "
++ param ^. paramName ++ "[] will forward their values in a list to the handler."]
else []) ++
(if (param ^. paramKind == Flag)