@@ -212,7 +212,7 @@ data Method = DocDELETE -- ^ the DELETE method
212 | DocGET -- ^ the GET method
212 | DocGET -- ^ the GET method
213 | DocPOST -- ^ the POST method
213 | DocPOST -- ^ the POST method
214 | DocPUT -- ^ the PUT method
214 | DocPUT -- ^ the PUT method
215− deriving (Eq, Generic)
215+ deriving (Eq, Ord, Generic)
217instance Show Method where
217instance Show Method where
218 show DocGET = "GET"
218 show DocGET = "GET"
@@ -239,7 +239,7 @@ instance Hashable Method
239data Endpoint = Endpoint
239data Endpoint = Endpoint
240 { _path :: [String] -- type collected
240 { _path :: [String] -- type collected
241 , _method :: Method -- type collected
241 , _method :: Method -- type collected
242− } deriving (Eq, Generic)
242+ } deriving (Eq, Ord, Generic)
244instance Show Endpoint where
244instance Show Endpoint where
245 show (Endpoint p m) =
245 show (Endpoint p m) =
@@ -291,7 +291,7 @@ emptyAPI = mempty
291data DocCapture = DocCapture
291data DocCapture = DocCapture
292 { _capSymbol :: String -- type supplied
292 { _capSymbol :: String -- type supplied
293 , _capDesc :: String -- user supplied
293 , _capDesc :: String -- user supplied
294− } deriving (Eq, Show)
294+ } deriving (Eq, Ord, Show)
296-- | A type to represent a /GET/ parameter from the Query String. Holds its name,
296-- | A type to represent a /GET/ parameter from the Query String. Holds its name,
297-- the possible values (leave empty if there isn't a finite number of them),
297-- the possible values (leave empty if there isn't a finite number of them),
@@ -303,7 +303,7 @@ data DocQueryParam = DocQueryParam
303 , _paramValues :: [String] -- user supplied
303 , _paramValues :: [String] -- user supplied
304 , _paramDesc :: String -- user supplied
304 , _paramDesc :: String -- user supplied
305 , _paramKind :: ParamKind
305 , _paramKind :: ParamKind
306− } deriving (Eq, Show)
306+ } deriving (Eq, Ord, Show)
308-- | An introductory paragraph for your documentation. You can pass these to
308-- | An introductory paragraph for your documentation. You can pass these to
309-- 'docsWithIntros'.
309-- 'docsWithIntros'.
@@ -322,7 +322,7 @@ instance Ord DocIntro where
322data DocNote = DocNote
322data DocNote = DocNote
323 { _noteTitle :: String
323 { _noteTitle :: String
324 , _noteBody :: [String]
324 , _noteBody :: [String]
325− } deriving (Eq, Show)
325+ } deriving (Eq, Ord, Show)
327-- | Type of extra information that a user may wish to "union" with their
327-- | Type of extra information that a user may wish to "union" with their
328-- documentation.
328-- documentation.
@@ -341,7 +341,7 @@ instance Monoid (ExtraInfo a) where
341-- - List corresponds to @QueryParams@, i.e GET parameters with multiple values
341-- - List corresponds to @QueryParams@, i.e GET parameters with multiple values
342-- - Flag corresponds to @QueryFlag@, i.e a value-less GET parameter
342-- - Flag corresponds to @QueryFlag@, i.e a value-less GET parameter
343data ParamKind = Normal | List | Flag
343data ParamKind = Normal | List | Flag
344− deriving (Eq, Show)
344+ deriving (Eq, Ord, Show)
346-- | A type to represent an HTTP response. Has an 'Int' status, a list of
346-- | A type to represent an HTTP response. Has an 'Int' status, a list of
347-- possible 'MediaType's, and a list of example 'ByteString' response bodies.
347-- possible 'MediaType's, and a list of example 'ByteString' response bodies.
@@ -362,7 +362,7 @@ data Response = Response
362 { _respStatus :: Int
362 { _respStatus :: Int
363 , _respTypes :: [M.MediaType]
363 , _respTypes :: [M.MediaType]
364 , _respBody :: [(Text, M.MediaType, ByteString)]
364 , _respBody :: [(Text, M.MediaType, ByteString)]
365− } deriving (Eq, Show)
365+ } deriving (Eq, Ord, Show)
367-- | Default response: status code 200, no response body.
367-- | Default response: status code 200, no response body.
@@ -394,7 +394,7 @@ data Action = Action
394 , _rqtypes :: [M.MediaType] -- type collected
394 , _rqtypes :: [M.MediaType] -- type collected
395 , _rqbody :: [(M.MediaType, ByteString)] -- user supplied
395 , _rqbody :: [(M.MediaType, ByteString)] -- user supplied
396 , _response :: Response -- user supplied
396 , _response :: Response -- user supplied
397− } deriving (Eq, Show)
397+ } deriving (Eq, Ord, Show)
399-- | Combine two Actions, we can't make a monoid as merging Response breaks the
399-- | Combine two Actions, we can't make a monoid as merging Response breaks the
@@ -611,7 +611,7 @@ class ToCapture c where
611markdown :: API -> String
611markdown :: API -> String
612markdown api = unlines $
612markdown api = unlines $
613 introsStr (api ^. apiIntros)
613 introsStr (api ^. apiIntros)
614− ++ (concatMap (uncurry printEndpoint) . HM.toList $ api ^. apiEndpoints)
614+ ++ (concatMap (uncurry printEndpoint) . sort . HM.toList $ api ^. apiEndpoints)
616 where printEndpoint :: Endpoint -> Action -> [String]
616 where printEndpoint :: Endpoint -> Action -> [String]
617 printEndpoint endpoint action =
617 printEndpoint endpoint action =