| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Servant.Docs.Internal
Contents
Synopsis
- data Endpoint = Endpoint {}
- showPath :: [String] -> String
- defEndpoint :: Endpoint
- data API = API {}
- emptyAPI :: API
- data DocCapture = DocCapture {
- _capSymbol :: String
- _capDesc :: String
- data DocQueryParam = DocQueryParam {
- _paramName :: String
- _paramValues :: [String]
- _paramDesc :: String
- _paramKind :: ParamKind
- data DocIntro = DocIntro {
- _introTitle :: String
- _introBody :: [String]
- data DocAuthentication = DocAuthentication {}
- data DocNote = DocNote {
- _noteTitle :: String
- _noteBody :: [String]
- newtype ExtraInfo api = ExtraInfo (HashMap Endpoint Action)
- data DocOptions = DocOptions {
- _maxSamples :: Int
- defaultDocOptions :: DocOptions
- data ParamKind
- data Response = Response {
- _respStatus :: Int
- _respTypes :: [MediaType]
- _respBody :: [(Text, MediaType, ByteString)]
- _respHeaders :: [Header]
- defResponse :: Response
- data Action = Action {
- _authInfo :: [DocAuthentication]
- _captures :: [DocCapture]
- _headers :: [Text]
- _params :: [DocQueryParam]
- _notes :: [DocNote]
- _mxParams :: [(String, [DocQueryParam])]
- _rqtypes :: [MediaType]
- _rqbody :: [(Text, MediaType, ByteString)]
- _response :: Response
- combineAction :: Action -> Action -> Action
- defAction :: Action
- single :: Endpoint -> Action -> API
- data ShowContentTypes
- data RenderingOptions = RenderingOptions {}
- defRenderingOptions :: RenderingOptions
- authIntro :: Lens' DocAuthentication String
- authDataRequired :: Lens' DocAuthentication String
- maxSamples :: Iso' DocOptions Int
- apiIntros :: Lens' API [DocIntro]
- apiEndpoints :: Lens' API (HashMap Endpoint Action)
- path :: Lens' Endpoint [String]
- method :: Lens' Endpoint Method
- capSymbol :: Lens' DocCapture String
- capDesc :: Lens' DocCapture String
- paramValues :: Lens' DocQueryParam [String]
- paramName :: Lens' DocQueryParam String
- paramKind :: Lens' DocQueryParam ParamKind
- paramDesc :: Lens' DocQueryParam String
- introTitle :: Lens' DocIntro String
- introBody :: Lens' DocIntro [String]
- noteTitle :: Lens' DocNote String
- noteBody :: Lens' DocNote [String]
- respTypes :: Lens' Response [MediaType]
- respStatus :: Lens' Response Int
- respHeaders :: Lens' Response [Header]
- respBody :: Lens' Response [(Text, MediaType, ByteString)]
- rqtypes :: Lens' Action [MediaType]
- rqbody :: Lens' Action [(Text, MediaType, ByteString)]
- response :: Lens' Action Response
- params :: Lens' Action [DocQueryParam]
- notes :: Lens' Action [DocNote]
- mxParams :: Lens' Action [(String, [DocQueryParam])]
- headers :: Lens' Action [Text]
- captures :: Lens' Action [DocCapture]
- authInfo :: Lens' Action [DocAuthentication]
- responseExamples :: Lens' RenderingOptions ShowContentTypes
- requestExamples :: Lens' RenderingOptions ShowContentTypes
- notesHeading :: Lens' RenderingOptions (Maybe String)
- docs :: HasDocs api => Proxy api -> API
- docsWithOptions :: HasDocs api => Proxy api -> DocOptions -> API
- extraInfo :: (IsIn endpoint api, HasLink endpoint, HasDocs endpoint) => Proxy endpoint -> Action -> ExtraInfo api
- docsWith :: HasDocs api => DocOptions -> [DocIntro] -> ExtraInfo api -> Proxy api -> API
- docsWithIntros :: HasDocs api => [DocIntro] -> Proxy api -> API
- class HasDocs api where
- class ToSample a where
- toSample :: forall a. ToSample a => Proxy a -> Maybe a
- noSamples :: [(Text, a)]
- singleSample :: a -> [(Text, a)]
- samples :: [a] -> [(Text, a)]
- defaultSamples :: forall a. (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)]
- class GToSample t where
- gtoSamples :: proxy t -> Omega (Text, t x)
- class AllHeaderSamples ls where
- allHeaderToSample :: Proxy ls -> [Header]
- sampleByteString :: forall ct cts a. (ToSample a, AllMimeRender (ct ': cts) a) => Proxy (ct ': cts) -> Proxy a -> [(MediaType, ByteString)]
- sampleByteStrings :: forall ct cts a. (ToSample a, AllMimeRender (ct ': cts) a) => Proxy (ct ': cts) -> Proxy a -> [(Text, MediaType, ByteString)]
- class ToParam t where
- toParam :: Proxy t -> DocQueryParam
- class ToCapture c where
- toCapture :: Proxy c -> DocCapture
- class ToAuthInfo a where
- toAuthInfo :: Proxy a -> DocAuthentication
- markdown :: API -> String
- markdownWith :: RenderingOptions -> API -> String
Documentation
An Endpoint type that holds the path and the method.
Gets used as the key in the API hashmap. Modify defEndpoint
or any Endpoint value you want using the path and method
lenses to tweak.
>>>defEndpoint"GET" /
>>>defEndpoint & path <>~ ["foo"]"GET" /foo
>>>defEndpoint & path <>~ ["foo"] & method .~ HTTP.methodPost"POST" /foo
Instances
| Eq Endpoint # | |
| Ord Endpoint # | |
Defined in Servant.Docs.Internal | |
| Show Endpoint # | |
| Generic Endpoint # | |
| Hashable Endpoint # | |
Defined in Servant.Docs.Internal | |
| type Rep Endpoint # | |
Defined in Servant.Docs.Internal type Rep Endpoint = D1 (MetaData "Endpoint" "Servant.Docs.Internal" "servant-docs-0.11.3-3mO9KoAgPUC4u53JknR8ZH" False) (C1 (MetaCons "Endpoint" PrefixI True) (S1 (MetaSel (Just "_path") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String]) :*: S1 (MetaSel (Just "_method") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Method))) | |
defEndpoint :: Endpoint #
An Endpoint whose path is `"/"` and whose method is GET
Here's how you can modify it:
>>>defEndpoint"GET" /
>>>defEndpoint & path <>~ ["foo"]"GET" /foo
>>>defEndpoint & path <>~ ["foo"] & method .~ HTTP.methodPost"POST" /foo
Our API documentation type, a product of top-level information and a good
old hashmap from Endpoint to Action
Constructors
| API | |
Fields
| |
data DocCapture #
A type to represent captures. Holds the name of the capture and a description.
Write a ToCapture instance for your captured types.
Constructors
| DocCapture | |
Fields
| |
Instances
| Eq DocCapture # | |
Defined in Servant.Docs.Internal | |
| Ord DocCapture # | |
Defined in Servant.Docs.Internal Methods compare :: DocCapture -> DocCapture -> Ordering # (<) :: DocCapture -> DocCapture -> Bool # (<=) :: DocCapture -> DocCapture -> Bool # (>) :: DocCapture -> DocCapture -> Bool # (>=) :: DocCapture -> DocCapture -> Bool # max :: DocCapture -> DocCapture -> DocCapture # min :: DocCapture -> DocCapture -> DocCapture # | |
| Show DocCapture # | |
Defined in Servant.Docs.Internal Methods showsPrec :: Int -> DocCapture -> ShowS # show :: DocCapture -> String # showList :: [DocCapture] -> ShowS # | |
data DocQueryParam #
A type to represent a GET (or other possible Method)
parameter from the Query String. Holds its name, the possible
values (leave empty if there isn't a finite number of them), and
a description of how it influences the output or behavior.
Write a ToParam instance for your GET parameter types
Constructors
| DocQueryParam | |
Fields
| |
Instances
| Eq DocQueryParam # | |
Defined in Servant.Docs.Internal Methods (==) :: DocQueryParam -> DocQueryParam -> Bool # (/=) :: DocQueryParam -> DocQueryParam -> Bool # | |
| Ord DocQueryParam # | |
Defined in Servant.Docs.Internal Methods compare :: DocQueryParam -> DocQueryParam -> Ordering # (<) :: DocQueryParam -> DocQueryParam -> Bool # (<=) :: DocQueryParam -> DocQueryParam -> Bool # (>) :: DocQueryParam -> DocQueryParam -> Bool # (>=) :: DocQueryParam -> DocQueryParam -> Bool # max :: DocQueryParam -> DocQueryParam -> DocQueryParam # min :: DocQueryParam -> DocQueryParam -> DocQueryParam # | |
| Show DocQueryParam # | |
Defined in Servant.Docs.Internal Methods showsPrec :: Int -> DocQueryParam -> ShowS # show :: DocQueryParam -> String # showList :: [DocQueryParam] -> ShowS # | |
An introductory paragraph for your documentation. You can pass these to
docsWithIntros.
Constructors
| DocIntro | |
Fields
| |
data DocAuthentication #
A type to represent Authentication information about an endpoint.
Constructors
| DocAuthentication | |
Fields | |
Instances
| Eq DocAuthentication # | |
Defined in Servant.Docs.Internal Methods (==) :: DocAuthentication -> DocAuthentication -> Bool # (/=) :: DocAuthentication -> DocAuthentication -> Bool # | |
| Ord DocAuthentication # | |
Defined in Servant.Docs.Internal Methods compare :: DocAuthentication -> DocAuthentication -> Ordering # (<) :: DocAuthentication -> DocAuthentication -> Bool # (<=) :: DocAuthentication -> DocAuthentication -> Bool # (>) :: DocAuthentication -> DocAuthentication -> Bool # (>=) :: DocAuthentication -> DocAuthentication -> Bool # max :: DocAuthentication -> DocAuthentication -> DocAuthentication # min :: DocAuthentication -> DocAuthentication -> DocAuthentication # | |
| Show DocAuthentication # | |
Defined in Servant.Docs.Internal Methods showsPrec :: Int -> DocAuthentication -> ShowS # show :: DocAuthentication -> String # showList :: [DocAuthentication] -> ShowS # | |
A type to represent extra notes that may be attached to an Action.
This is intended to be used when writing your own HasDocs instances to add extra sections to your endpoint's documentation.
Constructors
| DocNote | |
Fields
| |
Type of extra information that a user may wish to "union" with their documentation.
These are intended to be built using extraInfo. Multiple ExtraInfo may be combined with the monoid instance.
data DocOptions #
Documentation options.
Constructors
| DocOptions | |
Fields
| |
Instances
| Show DocOptions # | |
Defined in Servant.Docs.Internal Methods showsPrec :: Int -> DocOptions -> ShowS # show :: DocOptions -> String # showList :: [DocOptions] -> ShowS # | |
defaultDocOptions :: DocOptions #
Default documentation options.
Type of GET (or other Method) parameter:
- Normal corresponds to
QueryParam, i.e your usual GET parameter - List corresponds to
QueryParams, i.e GET parameters with multiple values - Flag corresponds to
QueryFlag, i.e a value-less GET parameter
Instances
| Eq ParamKind # | |
| Ord ParamKind # | |
| Show ParamKind # | |
A type to represent an HTTP response. Has an Int status, a list of
possible MediaTypes, and a list of example ByteString response bodies.
Tweak defResponse using the respStatus, respTypes and respBody
lenses if you want.
If you want to respond with a non-empty response body, you'll most likely
want to write a ToSample instance for the type that'll be represented
as encoded data in the response.
Can be tweaked with four lenses.
>>>defResponseResponse {_respStatus = 200, _respTypes = [], _respBody = [], _respHeaders = []}
>>>defResponse & respStatus .~ 204 & respBody .~ [("If everything goes well", "application/json", "{ \"status\": \"ok\" }")]Response {_respStatus = 204, _respTypes = [], _respBody = [("If everything goes well",application/json,"{ \"status\": \"ok\" }")], _respHeaders = []}
Constructors
| Response | |
Fields
| |
defResponse :: Response #
Default response: status code 200, no response body.
Can be tweaked with four lenses.
>>>defResponseResponse {_respStatus = 200, _respTypes = [], _respBody = [], _respHeaders = []}
>>>defResponse & respStatus .~ 204Response {_respStatus = 204, _respTypes = [], _respBody = [], _respHeaders = []}
A datatype that represents everything that can happen at an endpoint, with its lenses:
- List of captures (
captures) - List of GET (or other
Method) parameters (params) - What the request body should look like, if any is requested (
rqbody) - What the response should be if everything goes well (
response)
You can tweak an Action (like the default defAction) with these lenses
to transform an action and add some information to it.
Constructors
| Action | |
Fields
| |
combineAction :: Action -> Action -> Action #
Combine two Actions, we can't make a monoid as merging Response breaks the laws.
As such, we invent a non-commutative, left associative operation
combineAction to mush two together taking the response, body and content
types from the very left.
Default Action. Has no captures, no query params, expects
no request body (rqbody) and the typical response is defResponse.
Tweakable with lenses.
>>>defActionAction {_authInfo = [], _captures = [], _headers = [], _params = [], _notes = [], _mxParams = [], _rqtypes = [], _rqbody = [], _response = Response {_respStatus = 200, _respTypes = [], _respBody = [], _respHeaders = []}}
>>>defAction & response.respStatus .~ 201Action {_authInfo = [], _captures = [], _headers = [], _params = [], _notes = [], _mxParams = [], _rqtypes = [], _rqbody = [], _response = Response {_respStatus = 201, _respTypes = [], _respBody = [], _respHeaders = []}}
data ShowContentTypes #
How many content-types for each example should be shown?
Since: 0.11.1
Constructors
| AllContentTypes | For each example, show each content type. |
| FirstContentType | For each example, show only one content type. |
Instances
data RenderingOptions #
Customise how an API is converted into documentation.
Since: 0.11.1
Constructors
| RenderingOptions | |
Fields
| |
Instances
| Show RenderingOptions # | |
Defined in Servant.Docs.Internal Methods showsPrec :: Int -> RenderingOptions -> ShowS # show :: RenderingOptions -> String # showList :: [RenderingOptions] -> ShowS # | |
defRenderingOptions :: RenderingOptions #
Default API generation options.
All content types are shown for both requestExamples and
responseExamples; notesHeading is set to Nothing
(i.e. un-grouped).
Since: 0.11.1
maxSamples :: Iso' DocOptions Int #
paramValues :: Lens' DocQueryParam [String] #
respStatus :: Lens' Response Int #
respHeaders :: Lens' Response [Header] #
params :: Lens' Action [DocQueryParam] #
captures :: Lens' Action [DocCapture] #
docs :: HasDocs api => Proxy api -> API #
Generate the docs for a given API that implements HasDocs. This is the
default way to create documentation.
docs == docsWithOptions defaultDocOptions
docsWithOptions :: HasDocs api => Proxy api -> DocOptions -> API #
Generate the docs for a given API that implements HasDocs.
extraInfo :: (IsIn endpoint api, HasLink endpoint, HasDocs endpoint) => Proxy endpoint -> Action -> ExtraInfo api #
Create an ExtraInfo that is guaranteed to be within the given API layout.
The safety here is to ensure that you only add custom documentation to an endpoint that actually exists within your API.
extra :: ExtraInfo TestApi
extra =
extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete)) $
defAction & headers <>~ ["unicorns"]
& notes <>~ [ DocNote "Title" ["This is some text"]
, DocNote "Second secton" ["And some more"]
]docsWith :: HasDocs api => DocOptions -> [DocIntro] -> ExtraInfo api -> Proxy api -> API #
Generate documentation given some extra introductions (in the form of
DocInfo) and some extra endpoint documentation (in the form of
ExtraInfo.
The extra introductions will be prepended to the top of the documentation, before the specific endpoint documentation. The extra endpoint documentation will be "unioned" with the automatically generated endpoint documentation.
You are expected to build up the ExtraInfo with the Monoid instance and
extraInfo.
If you only want to add an introduction, use docsWithIntros.
docsWithIntros :: HasDocs api => [DocIntro] -> Proxy api -> API #
Generate the docs for a given API that implements HasDocs with with any
number of introduction(s)
The class that abstracts away the impact of API combinators on documentation generation.
Instances
| HasDocs Raw # | |
Defined in Servant.Docs.Internal | |
| HasDocs EmptyAPI # | The generated docs for |
Defined in Servant.Docs.Internal | |
| (HasDocs a, HasDocs b) => HasDocs (a :<|> b :: Type) # | The generated docs for |
Defined in Servant.Docs.Internal | |
| HasDocs api => HasDocs (WithNamedContext name context api :: Type) # | |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (WithNamedContext name context api) -> (Endpoint, Action) -> DocOptions -> API # | |
| HasDocs api => HasDocs (HttpVersion :> api :: Type) # | |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (HttpVersion :> api) -> (Endpoint, Action) -> DocOptions -> API # | |
| (HasDocs api, Accept ctype) => HasDocs (StreamBody' mods framing ctype a :> api :: Type) # | TODO: this instance is incomplete. |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (StreamBody' mods framing ctype a :> api) -> (Endpoint, Action) -> DocOptions -> API # | |
| (ToSample a, AllMimeRender (ct ': cts) a, HasDocs api) => HasDocs (ReqBody' mods (ct ': cts) a :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| HasDocs api => HasDocs (RemoteHost :> api :: Type) # | |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (RemoteHost :> api) -> (Endpoint, Action) -> DocOptions -> API # | |
| (KnownSymbol sym, ToParam (QueryParam' mods sym a), HasDocs api) => HasDocs (QueryParam' mods sym a :> api :: Type) # | |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (QueryParam' mods sym a :> api) -> (Endpoint, Action) -> DocOptions -> API # | |
| (KnownSymbol sym, ToParam (QueryParams sym a), HasDocs api) => HasDocs (QueryParams sym a :> api :: Type) # | |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (QueryParams sym a :> api) -> (Endpoint, Action) -> DocOptions -> API # | |
| (KnownSymbol sym, ToParam (QueryFlag sym), HasDocs api) => HasDocs (QueryFlag sym :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| (KnownSymbol sym, HasDocs api) => HasDocs (Header' mods sym a :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| HasDocs api => HasDocs (IsSecure :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| (KnownSymbol desc, HasDocs api) => HasDocs (Summary desc :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| (KnownSymbol desc, HasDocs api) => HasDocs (Description desc :> api :: Type) # | |
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (Description desc :> api) -> (Endpoint, Action) -> DocOptions -> API # | |
| (KnownSymbol sym, ToCapture (Capture sym a), HasDocs api) => HasDocs (Capture' mods sym a :> api :: Type) # |
|
Defined in Servant.Docs.Internal | |
| (KnownSymbol sym, ToCapture (CaptureAll sym a), HasDocs sublayout) => HasDocs (CaptureAll sym a :> sublayout :: Type) # |
|
Defined in Servant.Docs.Internal Methods docsFor :: Proxy (CaptureAll sym a :> sublayout) -> (Endpoint, Action) -> DocOptions -> API # | |
| (ToAuthInfo (BasicAuth realm usr), HasDocs api) => HasDocs (BasicAuth realm usr :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| HasDocs api => HasDocs (Vault :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| (KnownSymbol path, HasDocs api) => HasDocs (path :> api :: Type) # | |
Defined in Servant.Docs.Internal | |
| (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status, ReflectMethod method) => HasDocs (Verb method status (ct ': cts) a :: Type) # | |
Defined in Servant.Docs.Internal | |
| (ToSample a, AllMimeRender (ct ': cts) a, KnownNat status, ReflectMethod method, AllHeaderSamples ls, GetHeaders (HList ls)) => HasDocs (Verb method status (ct ': cts) (Headers ls a) :: Type) # | |
Defined in Servant.Docs.Internal | |
| (Accept ct, KnownNat status, ReflectMethod method) => HasDocs (Stream method status framing ct a :: Type) # | TODO: mention the endpoint is streaming, its framing strategy Also there are no samples. TODO: AcceptFraming for content-type |
Defined in Servant.Docs.Internal | |
The class that lets us display a sample input or output in the supported content-types when generating documentation for endpoints that either:
- expect a request body, or
- return a non empty response body
Example of an instance:
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
import Data.Aeson
import Data.Text
import GHC.Generics
data Greet = Greet { _msg :: Text }
deriving (Generic, Show)
instance FromJSON Greet
instance ToJSON Greet
instance ToSample Greet where
toSamples _ = singleSample g
where g = Greet "Hello, haskeller!"You can also instantiate this class using toSamples instead of
toSample: it lets you specify different responses along with
some context (as ErrorMessage) that explains when you're supposed to
get the corresponding response.
Minimal complete definition
Nothing
Methods
toSamples :: Proxy a -> [(Text, a)] #
toSamples :: (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)] #
Instances
toSample :: forall a. ToSample a => Proxy a -> Maybe a #
Sample input or output (if there is at least one).
singleSample :: a -> [(Text, a)] #
Single sample without description.
defaultSamples :: forall a. (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)] #
Default sample Generic-based inputs/outputs.
for Generics.ToSample
The use of allows for more productive sample generation.Omega
Methods
gtoSamples :: proxy t -> Omega (Text, t x) #
Instances
| GToSample (V1 :: k -> Type) # | |
Defined in Servant.Docs.Internal | |
| GToSample (U1 :: k -> Type) # | |
Defined in Servant.Docs.Internal | |
| (GToSample p, GToSample q) => GToSample (p :+: q :: k -> Type) # | |
Defined in Servant.Docs.Internal | |
| (GToSample p, GToSample q) => GToSample (p :*: q :: k -> Type) # | |
Defined in Servant.Docs.Internal | |
| ToSample a => GToSample (K1 i a :: k -> Type) # | |
Defined in Servant.Docs.Internal | |
| GToSample f => GToSample (M1 i a f :: k -> Type) # | |
Defined in Servant.Docs.Internal | |
class AllHeaderSamples ls where #
Methods
allHeaderToSample :: Proxy ls -> [Header] #
Instances
| AllHeaderSamples ([] :: [k]) # | |
Defined in Servant.Docs.Internal Methods allHeaderToSample :: Proxy [] -> [Header] # | |
| (ToHttpApiData l, AllHeaderSamples ls, ToSample l, KnownSymbol h) => AllHeaderSamples (Header h l ': ls :: [Type]) # | |
Defined in Servant.Docs.Internal Methods allHeaderToSample :: Proxy (Header h l ': ls) -> [Header0] # | |
sampleByteString :: forall ct cts a. (ToSample a, AllMimeRender (ct ': cts) a) => Proxy (ct ': cts) -> Proxy a -> [(MediaType, ByteString)] #
Synthesise a sample value of a type, encoded in the specified media types.
sampleByteStrings :: forall ct cts a. (ToSample a, AllMimeRender (ct ': cts) a) => Proxy (ct ': cts) -> Proxy a -> [(Text, MediaType, ByteString)] #
Synthesise a list of sample values of a particular type, encoded in the specified media types.
The class that helps us automatically get documentation for GET
(or other Method) parameters.
Example of an instance:
instance ToParam (QueryParam' mods "capital" Bool) where
toParam _ =
DocQueryParam "capital"
["true", "false"]
"Get the greeting message in uppercase (true) or not (false). Default is false."Methods
toParam :: Proxy t -> DocQueryParam #
The class that helps us automatically get documentation for URL captures.
Example of an instance:
instance ToCapture (Capture "name" Text) where toCapture _ = DocCapture "name" "name of the person to greet"
Methods
toCapture :: Proxy c -> DocCapture #
class ToAuthInfo a where #
The class that helps us get documentation for authenticated endpoints
Methods
toAuthInfo :: Proxy a -> DocAuthentication #
Generate documentation in Markdown format for
the given API.
This is equivalent to .markdownWith defRenderingOptions
markdownWith :: RenderingOptions -> API -> String #
Generate documentation in Markdown format for
the given API using the specified options.
These options allow you to customise aspects such as:
- Choose how many content-types for each request body example are
shown with
requestExamples. - Choose how many content-types for each response body example
are shown with
responseExamples.
For example, to only show the first content-type of each example:
markdownWith (defRenderingOptions&requestExamples.~FirstContentType&responseExamples.~FirstContentType) myAPI
Since: 0.11.1
Instances
>>>:set -XOverloadedStrings