Commit Graph

99 Commits

Author SHA1 Message Date
andremarianiello 751350ba9e
WithResource combinator for Servant-managed resources (#1630) 2022-12-29 19:00:47 +01:00
Gaël Deest 9c81b4927a Add support for NamedRoutes in servant-docs 2022-04-19 12:51:31 +02:00
Caroline GAUDREAU 04e4de5260
Merge pull request #1357 from SupercedeTech/master
servant-docs: Add support of Pretty modifier for all verbs aliases
2021-11-17 14:42:24 +01:00
akhesaCaro 6e5dffbb91 unsupporting GHC < 8.6.5, removing unecessary imports 2021-10-02 13:13:24 +02:00
Dan Fithian 47bd25266f
Servant docs curl (#1401)
servant-dosc: generate sample curl request
2021-08-19 13:11:00 +02:00
Samuel Gélineau 0cb2d603c4
use Capture Description if available (#1423)
* use Capture Description if available

* update golden/comprehensive.md

This is technically a breaking change, because if a Capture has both a
Description and a ToCapture instance, the Description now takes
precedence. Since this Description wasn't doing anything before, I am
guessing that most projects currently only use Description to describe
their endpoints and not their Captures, and thus that few people will be
affected by this breaking change.

* test the "no ToCapture instance" case

The case in which there is both a Description and a ToCapture instance
seems like a corner case. The more interesting cases are the one in
which there is a Description but no ToCapture instance, and the case in
which there is a ToCapture instance but no description.
2021-06-08 13:28:19 -05:00
Andrey Prokopenko da0c83d318
Add URI fragment as a separate combinator (#1324) 2020-11-18 21:57:20 +03:00
Никита Размахнин 0ea692bb64 Add support of Pretty modifier for all verbs aliases
Minor import warning fix
2020-11-11 10:22:55 +03:00
Cary Robbins 83bbc6d520
Add instance for ToSample NonEmpty (#1330) 2020-10-01 14:02:43 +02:00
Jan Hrcek b9d8fbcdc1
Fix typos and grammar (#1304)
* Fix typos and grammar

* Remove redundant words, fix articles

* More language fixes

* More typo fixes and resolve TODO about missing links
2020-06-06 00:43:51 -04:00
Oleg Grenrus e229efdf25
Merge pull request #1241 from Simspace/issue-1240
merge documentation from duplicate routes
2019-12-14 22:23:25 +02:00
Samuel Gélineau 1f6d7d7ea8 remove leftover debug code 2019-11-07 19:01:56 -05:00
Samuel Gélineau 143091eb3f merge documentation from duplicate routes
Servant supports defining the same route multiple times with different
content-types and result-types, but servant-docs was only documenting
the first of copy of such duplicated routes. It now combines the
documentation from all the copies.

Unfortunately, it is not yet possible for the documentation to specify
multiple status codes.
2019-11-07 18:53:41 -05:00
Catherine Galkina 0ec5af11f5 Fixed docs for NoContent endpoints 2019-09-29 14:18:13 +03:00
Oleg Grenrus 19dee18f71 Remove control-monad-omega dependency 2019-09-28 17:43:28 +03:00
Oleg Grenrus 3001ed7990 Add mods to StreamBody 2018-11-09 21:49:53 +02:00
Oleg Grenrus 953747b55b Correct some doctest looking things to be doctests 2018-11-08 17:12:20 +02:00
Oleg Grenrus 7bed805cf7 Golden test for comprehensive API docs 2018-11-08 16:32:10 +02:00
Oleg Grenrus e94919f4b3
Merge pull request #991 from phadej/servant-machines
Streaming refactoring
2018-11-05 16:23:15 +02:00
Oleg Grenrus 45c1cbdfd5 Refactor Stream stuff
- Introduce SourceT, which is simple variant of "correct `ListT`".
  There are another variants possible (like in `streaming`),
  but I'm not sure there's much real difference.

- Introduce `Codensity`. There's a flag if people don't want to depend
  on `kan-extensions`.

- `StreamGenerator` and `ResultStream` are both `SourceT`.
  `Stream` combinator in `servant-client` uses `Codensity` for CPS.

- Add servant-machines, servant-conduit, servant-pipes
- Add streaming cookbook: just code, no explanations.
- Add a script to run streaming 'benchmarks'
2018-11-05 15:48:47 +02:00
Robert Soeldner a2f8c2c9b4 Fix markdown code indent, drop unused var 2018-09-29 17:49:06 +02:00
Oleg Grenrus cfade67c2f Cleanup pre-GHC-8.0 stuff 2018-07-11 01:39:38 +03:00
Oleg Grenrus f9bcc15d0b Apply stylish-haskell on all modules 2018-06-29 23:36:39 +03:00
Oleg Grenrus dcc67f3089 Add FromResultStream/ToStreamGenerator [a] instances.
- Add Streaming endpoint to the comprehensive API.
- Rename BuildFromStream to FromResultStram
   - I'm tempted to rename everything in the Servant.API.Stream
     (add some prefixes, `header` is too good name to steal)

The TODO in `servant-docs` is left intentionally.
2018-06-24 21:52:09 +03:00
Oleg Grenrus 3e1748c965 Add description modifier helpers and parametrise Capture 2018-02-15 12:28:42 +02:00
Oleg Grenrus bc3f61d615 Add Servant.API.Modifiers to servant
Changes Header, ReqBody and QueryParam to take a modifier list.

Resolves https://github.com/haskell-servant/servant/issues/856

ResponseHeader story turns to be somewhat ugly, but it can be made
elegant when https://github.com/haskell-servant/servant/issues/841 is
implemnted, then we can omit HList aka Header Heterogenous List
implementation.

- servant-server changes:

  Writing server side intepretations is quite simple using
  `unfoldRequestArgument`, which makes Header and QueryParam look quite
  the same.

  `ReqBody` cannot be easily made optional with current design (what that
  would mean: No Content-Type Header?), so that dimensions isn't used
  there.

- Add HasLink for all the rest ComprehensiveAPI combinators
- Add 'tricky' Header', QueryParam' endpoints to ComprehensiveAPI
- servant-docs: Quick'n'dirty implementation. Don't use modifiers information (yet).
2018-01-25 09:10:11 +02:00
Ivan Lazar Miljenovic 6df200326f Add an option to wrap notes in a separate header
Closes #831, using option 3.
2017-10-11 12:12:48 +11:00
Ivan Lazar Miljenovic 9d10fe13dd Use 3rd-level headings
For some reason, 2nd-level headings are used for introductions and for
each API endpoint, but then it immediately jumps to 4th-level
headings.

Instead, promote everything that's 4th-level to 3rd-level.
2017-10-11 10:48:22 +11:00
Ivan Lazar Miljenovic ed3ace3066 Handle request/response bodies with empty titles 2017-10-06 13:19:04 +11:00
Ivan Lazar Miljenovic ddcb3560e0 Better haddocks for new documentation 2017-10-06 11:13:57 +11:00
Ivan Lazar Miljenovic a693648044 A better name for ApiOptions
It's more about how rendering happens than options for the API.
2017-10-06 10:59:00 +11:00
Ivan Lazar Miljenovic 354bee8d32 Remove unused uncurry3 function 2017-10-06 10:54:55 +11:00
Ivan Lazar Miljenovic 09896b5f39 Group mime-types together, and control how many get displayed
Closes #815
2017-10-05 16:29:43 +11:00
Ivan Lazar Miljenovic 41d75b4de8 Combine rendering of code samples for request/response bodies
This does mean that the "Example" portion for reqeust bodies is lost
though.
2017-10-05 16:29:43 +11:00
Ivan Lazar Miljenovic 4f8df0ebe2 Make sure code blocks are indented in markdown documentation
This relies on the behaviour of pandoc, and as such may not apply to
other Markdown renderers.

Before this change, you would have something like:

> - Example: `application/json`
>
> ```javascript
> "HELLO, HASKELLER"
> ```

When converting this to HTML, PDF, etc. the code block is _not_
contained within the bullet point.

With this change, the generated markdown looks like:

> - Example: `application/json`
>
>     ```javascript
> "HELLO, HASKELLER"
>     ```

With pandoc at least, this effectively indents the entire code block
to be under the bullet point, which is the intended effect.

Note that the code itself is _not_ indented (which might break other
Markdown renderers) as to do so would require splitting on newlines,
which may have unintended consequences when dealing with generated
values (may contain `\r\n`, etc.).
2017-10-05 16:29:43 +11:00
Ivan Lazar Miljenovic 061bf7a5b1 Add markdown type for text/xml
As it's an alternative mime-type for XML
2017-10-05 16:29:43 +11:00
Alp Mestanogullari 4a6edd7864 Merge pull request #813 from ivan-m/response-content-type
List content type with response examples
2017-09-25 10:38:02 +02:00
Ivan Lazar Miljenovic 81184df3d4 List content type with response examples 2017-09-22 14:12:13 +10:00
Oleg Grenrus 50be3a263b Merge pull request #767 from fierce-katie/docs-combinators
Description and Summary combinators
2017-08-16 15:31:12 +03:00
Oleg Grenrus 24035ddd85 Merge pull request #790 from ivan-m/query-param-method
Document the type of endpoint a parameter belongs to
2017-07-31 11:41:13 +03:00
Oleg Grenrus a9bc22d5c9 Merge pull request #788 from ivan-m/header-location
Move location of header information
2017-07-31 11:40:41 +03:00
Ivan Lazar Miljenovic a2c6ef773d Changed to adding a Headers header
As per request by @phadej
2017-07-31 10:56:01 +10:00
Ivan Lazar Miljenovic 6fc4c735c4 Merge branch 'master' into query-param-method 2017-07-28 22:52:34 +10:00
Ivan Lazar Miljenovic 31578b9bfa Make defAction's documentation visible to Haddock 2017-07-28 16:39:52 +10:00
Ivan Lazar Miljenovic 256ee41254 Update documentation such that it isn't just for GET 2017-07-28 16:39:05 +10:00
Ivan Lazar Miljenovic 89e0a98ac5 Document the type of endpoint a parameter belongs to
Closes #760
2017-07-28 16:31:55 +10:00
Ivan Lazar Miljenovic 7221368cdd Move location of header information
Currently, it appears after the notes, authentication and capture
information... such that if any of those exist, then the list of
header sensitivity will appear to be an item of one of the previous
ones (as they provide Markdown headers).
2017-07-28 15:32:19 +10:00
ishiy 1ba7624e69 Improve authStr in markdown 2017-06-29 19:01:46 +09:00
Catherine Galkina ec0431d930 Add instances for new combinators 2017-06-08 18:27:36 +03:00
Oleg Grenrus f0eec498a1 Merge pull request #755 from osa1/fix_reqbody_samples
Don't drop samples in `HasDocs ReqBody` instance
2017-05-19 14:58:06 +03:00