git.iko.soy/typeable/servant
on master help sign in
A better name for ApiOptions
a693648Ivan Lazar Miljenovic
servant-docs/src/Servant/Docs.hs+1−1
@@ -25,7 +25,7 @@ module Servant.Docs
25 ( -- * 'HasDocs' class and key functions
25 ( -- * 'HasDocs' class and key functions
26 HasDocs(..), docs, pretty, markdown
26 HasDocs(..), docs, pretty, markdown
27 -- ** Customising generated documentation
27 -- ** Customising generated documentation
28− , markdownWith, ApiOptions(..), defApiOptions
28+ , markdownWith, RenderingOptions(..), defRenderingOptions
29 , requestExamples, responseExamples, ShowContentTypes(..)
29 , requestExamples, responseExamples, ShowContentTypes(..)
30 -- * Generating docs with extra information
30 -- * Generating docs with extra information
31 , docsWith, docsWithIntros, docsWithOptions
31 , docsWith, docsWithIntros, docsWithOptions
servant-docs/src/Servant/Docs/Internal.hs+7−7
@@ -303,14 +303,14 @@ data ShowContentTypes = AllContentTypes | FirstContentType
303 deriving (Eq, Ord, Show, Read, Bounded, Enum)
303 deriving (Eq, Ord, Show, Read, Bounded, Enum)
304
304
305-- | Customise how an 'API' is converted into documentation.
305-- | Customise how an 'API' is converted into documentation.
306−data ApiOptions = ApiOptions
306+data RenderingOptions = RenderingOptions
307 { _requestExamples :: !ShowContentTypes
307 { _requestExamples :: !ShowContentTypes
308 , _responseExamples :: !ShowContentTypes
308 , _responseExamples :: !ShowContentTypes
309 } deriving (Show)
309 } deriving (Show)
310
310
311-- | Default API generation options.
311-- | Default API generation options.
312−defApiOptions :: ApiOptions
312+defRenderingOptions :: RenderingOptions
313−defApiOptions = ApiOptions
313+defRenderingOptions = RenderingOptions
314 { _requestExamples = AllContentTypes
314 { _requestExamples = AllContentTypes
315 , _responseExamples = AllContentTypes
315 , _responseExamples = AllContentTypes
316 }
316 }
@@ -326,7 +326,7 @@ makeLenses ''DocIntro
326makeLenses ''DocNote
326makeLenses ''DocNote
327makeLenses ''Response
327makeLenses ''Response
328makeLenses ''Action
328makeLenses ''Action
329−makeLenses ''ApiOptions
329+makeLenses ''RenderingOptions
330
330
331-- | Generate the docs for a given API that implements 'HasDocs'. This is the
331-- | Generate the docs for a given API that implements 'HasDocs'. This is the
332-- default way to create documentation.
332-- default way to create documentation.
@@ -543,10 +543,10 @@ class ToAuthInfo a where
543-- | Generate documentation in Markdown format for
543-- | Generate documentation in Markdown format for
544-- the given 'API'.
544-- the given 'API'.
545markdown :: API -> String
545markdown :: API -> String
546−markdown = markdownWith defApiOptions
546+markdown = markdownWith defRenderingOptions
547
547
548−markdownWith :: ApiOptions -> API -> String
548+markdownWith :: RenderingOptions -> API -> String
549−markdownWith ApiOptions{..} api = unlines $
549+markdownWith RenderingOptions{..} api = unlines $
550 introsStr (api ^. apiIntros)
550 introsStr (api ^. apiIntros)
551 ++ (concatMap (uncurry printEndpoint) . sort . HM.toList $ api ^. apiEndpoints)
551 ++ (concatMap (uncurry printEndpoint) . sort . HM.toList $ api ^. apiEndpoints)
552
552