Rename safeInfo to extraInfo
This commit is contained in:
parent
b935f28185
commit
53d3f6db80
2 changed files with 8 additions and 8 deletions
|
@ -88,7 +88,7 @@ testApi = Proxy
|
||||||
-- notes.
|
-- notes.
|
||||||
extra :: ExtraInfo TestApi
|
extra :: ExtraInfo TestApi
|
||||||
extra =
|
extra =
|
||||||
safeInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
|
extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
|
||||||
defAction & headers <>~ ["unicorns"]
|
defAction & headers <>~ ["unicorns"]
|
||||||
& notes <>~ [ DocNote "Title" ["This is some text"]
|
& notes <>~ [ DocNote "Title" ["This is some text"]
|
||||||
, DocNote "Second secton" ["And some more"]
|
, DocNote "Second secton" ["And some more"]
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
-- > -- notes.
|
-- > -- notes.
|
||||||
-- > extra :: ExtraInfo TestApi
|
-- > extra :: ExtraInfo TestApi
|
||||||
-- > extra =
|
-- > extra =
|
||||||
-- > safeInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
|
-- > extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
|
||||||
-- > defAction & headers <>~ ["unicorns"]
|
-- > defAction & headers <>~ ["unicorns"]
|
||||||
-- > & notes <>~ [ DocNote "Title" ["This is some text"]
|
-- > & notes <>~ [ DocNote "Title" ["This is some text"]
|
||||||
-- > , DocNote "Second secton" ["And some more"]
|
-- > , DocNote "Second secton" ["And some more"]
|
||||||
|
@ -149,7 +149,7 @@ module Servant.Docs
|
||||||
( -- * 'HasDocs' class and key functions
|
( -- * 'HasDocs' class and key functions
|
||||||
HasDocs(..), docs, markdown
|
HasDocs(..), docs, markdown
|
||||||
-- * Generating docs with extra information
|
-- * Generating docs with extra information
|
||||||
, ExtraInfo(..), docsWith, docsWithIntros, safeInfo
|
, ExtraInfo(..), docsWith, docsWithIntros, extraInfo
|
||||||
|
|
||||||
, -- * Classes you need to implement for your types
|
, -- * Classes you need to implement for your types
|
||||||
ToSample(..)
|
ToSample(..)
|
||||||
|
@ -317,7 +317,7 @@ data DocNote = DocNote
|
||||||
-- | Type of extra information that a user may wish to "union" with their
|
-- | Type of extra information that a user may wish to "union" with their
|
||||||
-- documentation.
|
-- documentation.
|
||||||
--
|
--
|
||||||
-- These are intended to be built using safeInfo.
|
-- These are intended to be built using extraInfo.
|
||||||
-- Multiple ExtraInfo may be combined with the monoid instance.
|
-- Multiple ExtraInfo may be combined with the monoid instance.
|
||||||
newtype ExtraInfo layout = ExtraInfo (HashMap Endpoint Action)
|
newtype ExtraInfo layout = ExtraInfo (HashMap Endpoint Action)
|
||||||
instance Monoid (ExtraInfo a) where
|
instance Monoid (ExtraInfo a) where
|
||||||
|
@ -448,15 +448,15 @@ type family IsIn (endpoint :: *) (api :: *) :: Constraint where
|
||||||
--
|
--
|
||||||
-- > extra :: ExtraInfo TestApi
|
-- > extra :: ExtraInfo TestApi
|
||||||
-- > extra =
|
-- > extra =
|
||||||
-- > safeInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
|
-- > extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
|
||||||
-- > defAction & headers <>~ ["unicorns"]
|
-- > defAction & headers <>~ ["unicorns"]
|
||||||
-- > & notes <>~ [ DocNote "Title" ["This is some text"]
|
-- > & notes <>~ [ DocNote "Title" ["This is some text"]
|
||||||
-- > , DocNote "Second secton" ["And some more"]
|
-- > , DocNote "Second secton" ["And some more"]
|
||||||
-- > ]
|
-- > ]
|
||||||
|
|
||||||
safeInfo :: (IsIn endpoint layout, HasLink endpoint, HasDocs endpoint)
|
extraInfo :: (IsIn endpoint layout, HasLink endpoint, HasDocs endpoint)
|
||||||
=> Proxy endpoint -> Action -> ExtraInfo layout
|
=> Proxy endpoint -> Action -> ExtraInfo layout
|
||||||
safeInfo p action =
|
extraInfo p action =
|
||||||
let api = docsFor p (defEndpoint, defAction)
|
let api = docsFor p (defEndpoint, defAction)
|
||||||
-- Assume one endpoint, HasLink constraint means that we should only ever
|
-- Assume one endpoint, HasLink constraint means that we should only ever
|
||||||
-- point at one endpoint.
|
-- point at one endpoint.
|
||||||
|
@ -471,7 +471,7 @@ safeInfo p action =
|
||||||
-- will be "unioned" with the automatically generated endpoint documentation.
|
-- will be "unioned" with the automatically generated endpoint documentation.
|
||||||
--
|
--
|
||||||
-- You are expected to build up the ExtraInfo with the Monoid instance and
|
-- You are expected to build up the ExtraInfo with the Monoid instance and
|
||||||
-- 'safeInfo'.
|
-- 'extraInfo'.
|
||||||
--
|
--
|
||||||
-- If you only want to add an introduction, use 'docsWithIntros'.
|
-- If you only want to add an introduction, use 'docsWithIntros'.
|
||||||
docsWith :: HasDocs layout
|
docsWith :: HasDocs layout
|
||||||
|
|
Loading…
Reference in a new issue