| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Servant.Docs.Simple.Render
Description
Provides an Intermediate documentation structure (Endpoints), and renderable formats (Renderable)
Synopsis
Documentation
Intermediate documentation structure, a linked-list of endpoints (Nodes)
API type:
type API = "users" :> ( "update" :> Response '[()] ()
:<|> "get" :> Response '[()] ()
)Parsed into Endpoints:
Endpoints [ Node "/users/update"
(Details [ Node "Response"
(Details [ Node "Format" (Detail "': * () ('[] *)")
, Node "ContentType" (Detail "()")
])
])
, Node "/users/get"
(Details [ Node "Response"
(Details [ Node "Format" (Detail "': * () ('[] *)")
, Node "ContentType" (Detail "()")
])
])
]For a breakdown reference Node
For more examples reference Test.Servant.Docs.Simple.Samples
Key-Value pair for endpoint parameters and their values
Example 1
An endpoint is represented as a node, with the route as its parameter and its Details as its value
Node "/users/get" <Details>
Example 2
Details of each endpoint can also be represented as nodes
Given the following:
Response '[()] ()
This can be interpreted as a Response parameter, with a value of 2 Details, Format and ContentType
In turn, this:
Format: @'[()]@
can be interpreted as a Format parameter with a value of '[()].
And so parsing Response '[()] () comes together as:
Node "Response" --- Parameter
(Details [ Node "Format" -- Parameter ---
(Detail "': * () ('[] *)") -- Value |
, Node "ContentType" -- Parameter | Value
(Detail "()") -- Value |
]) ---class Renderable a where Source #
Convert Endpoints into different documentation formats
Instances
| Renderable PlainText Source # | |
| Renderable Json Source # | |
| Renderable (Pretty ann) Source # | |
Conversion to JSON using Data.Aeson
Conversion to prettyprint
Instances
| Renderable (Pretty ann) Source # | |