Commit graph

81 commits

Author SHA1 Message Date
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
Oleg Grenrus
53b352711b Merge pull request #787 from ivan-m/doc-auth-lenses
Export authentication-related types/lenses
2017-07-28 15:13:23 +03: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
Ivan Lazar Miljenovic
8e67e26d63 Export authentication-related types/lenses
I'm assuming that they're not meant to be just in `.Internal`.
2017-07-28 15:15:16 +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
Ömer Sinan Ağacan
d8dd1cb90a Don't drop samples in HasDocs ReqBody instance
As reported in #754, `HasDocs` instance of `ReqBody` was dropping samples other
than the first one. With this patch we show at most `_maxSamples` samples for
`ReqBody`, and also include the sample title in the docs.
2017-05-16 14:19:52 +03:00
David Turner
2cfa71891b Add instance HasDocs EmptyAPI 2017-05-16 10:07:15 +00:00
Oleg Grenrus
fdf86b0e15 Add Semigroup instances 2017-01-19 20:11:54 +02:00
Julian K. Arni
92b1196830 Redundant import fixes 2017-01-16 13:20:39 +02:00
Nickolay Kudasov
a6de4ba123 Remove IsIn from servant-docs 2017-01-16 13:20:39 +02:00
Alex Mason
5bef76ed03 Remove all use of bytestring-conversion 2016-09-02 23:27:37 +10:00
Jonathan Lange
ed702f5927 servant-docs support for CaptureAll 2016-07-11 14:47:05 +01:00
Arian van Putten
05379ed7e3 Replace all occurances of () with NoContent
We use NoContent to signify an empty response nowadays. This commit
replaces all occurences of () with NoContent so that all packages use
the new semantics.
2016-07-10 16:58:59 +02:00
Sönke Hahn
5effdfdbbb Rename type variables 'layout' and 'sublayout' to 'api' 2016-07-03 22:46:46 +08:00
aaron levin
f13c61956c Add authentication support to servant-docs 2016-03-08 23:13:05 +01:00
Sönke Hahn
8ef4d4543b renaming: Config -> Context 2016-03-07 23:12:24 +08:00
Sönke Hahn
2176fecfda config: added instances for all interpretations 2016-01-21 17:55:02 +01:00
Julian K. Arni
641431d5b2 Fix extra quotes in Verb headers for docs.
Fixes #325.
2016-01-15 12:17:48 +01:00
Julian K. Arni
37afddf3a2 Re-add missing Header instance for docs. 2016-01-11 13:37:20 +01:00
Julian K. Arni
208bcf5986 Use Verb for servant-docs 2016-01-07 13:47:08 +01:00
Julian K. Arni
5909a6df7a Fix rebase issues. 2016-01-07 13:47:08 +01:00
Julian K. Arni
cda8bcf17c Simplify verb combinators.
Create a single 'Verb' combinator with parameters for status code and
        method. Make existing combinators type synonyms of 'Verb'.
2016-01-07 13:47:07 +01:00
Julian K. Arni
79d4f944a4 less OverlappingInstances noise 2016-01-04 13:09:11 -05:00
Tomasz Mieszkowski
69a4a8d4f6 [servant-docs] Removed redundant imports. 2015-12-20 17:56:11 +01:00
Mitchell Rosen
f1a6a2a151 Move 'pretty' to its own module 2015-12-10 12:27:15 -08:00
Mitchell Rosen
702c2cec7d Add 'pretty' 2015-12-09 18:38:31 -08:00
Andres Loeh
1398d1f5e1 More systematic approach to delayed checks.
This introduces a `Delayed` type in `RoutingApplication.hs` that
contains a handler together with delayed checks. There are several
blocks of delayed checks, so that we can ultimately execute them in the
order we desire.

The process is documented in more detail in `RoutingApplication.hs`.
2015-10-26 16:56:25 +01:00
Julian K. Arni
ec55f4b981 Remove Matrix params.
For servant-docs, -foreign, -js, and -mock.
2015-10-13 21:37:07 +02:00