Canonicalize API before generating docs.
This commit is contained in:
parent
f90348c03a
commit
b23b334128
2 changed files with 5 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
||||||
* Render endpoints in a canonical order (https://github.com/haskell-servant/servant-docs/pull/15)
|
* Render endpoints in a canonical order (https://github.com/haskell-servant/servant-docs/pull/15)
|
||||||
* Remove ToJSON superclass from ToSample
|
* Remove ToJSON superclass from ToSample
|
||||||
* Split out Internal module
|
* Split out Internal module
|
||||||
|
* `Canonicalize` API types before generating the docs for them
|
||||||
|
|
||||||
0.3
|
0.3
|
||||||
---
|
---
|
||||||
|
|
|
@ -273,8 +273,8 @@ makeLenses ''Action
|
||||||
|
|
||||||
-- | Generate the docs for a given API that implements 'HasDocs'. This is the
|
-- | Generate the docs for a given API that implements 'HasDocs'. This is the
|
||||||
-- default way to create documentation.
|
-- default way to create documentation.
|
||||||
docs :: HasDocs layout => Proxy layout -> API
|
docs :: HasDocs (Canonicalize layout) => Proxy layout -> API
|
||||||
docs p = docsFor p (defEndpoint, defAction)
|
docs p = docsFor (canonicalize p) (defEndpoint, defAction)
|
||||||
|
|
||||||
-- | Closed type family, check if endpoint is exactly within API.
|
-- | Closed type family, check if endpoint is exactly within API.
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ extraInfo p action =
|
||||||
-- 'extraInfo'.
|
-- '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 (Canonicalize layout)
|
||||||
=> [DocIntro]
|
=> [DocIntro]
|
||||||
-> ExtraInfo layout
|
-> ExtraInfo layout
|
||||||
-> Proxy layout
|
-> Proxy layout
|
||||||
|
@ -330,7 +330,7 @@ docsWith intros (ExtraInfo endpoints) p =
|
||||||
|
|
||||||
-- | Generate the docs for a given API that implements 'HasDocs' with with any
|
-- | Generate the docs for a given API that implements 'HasDocs' with with any
|
||||||
-- number of introduction(s)
|
-- number of introduction(s)
|
||||||
docsWithIntros :: HasDocs layout => [DocIntro] -> Proxy layout -> API
|
docsWithIntros :: HasDocs (Canonicalize layout) => [DocIntro] -> Proxy layout -> API
|
||||||
docsWithIntros intros = docsWith intros mempty
|
docsWithIntros intros = docsWith intros mempty
|
||||||
|
|
||||||
-- | The class that abstracts away the impact of API combinators
|
-- | The class that abstracts away the impact of API combinators
|
||||||
|
|
Loading…
Add table
Reference in a new issue