87 Commits

Author SHA1 Message Date
Spring Operator
1fa4c293c6 Use HTTPS for external links where possible
See gh-610
2019-03-26 11:28:26 +00:00
Andy Wilkinson
2cfe47a330 Merge branch '1.0.x' into 1.1.x 2019-03-26 10:53:52 +00:00
Spring Operator
f2e60ea347 Use HTTPS for external links where possible
See gh-609
2019-03-26 10:28:47 +00:00
Andy Wilkinson
f7e61013bb Merge branch '1.0.x' into 1.1.x 2019-03-19 11:24:34 +00:00
Andy Wilkinson
75132b537a Use HTTPS to link to Apache license 2019-03-19 11:21:34 +00:00
Andy Wilkinson
b6120cd539 Fix broken cross-reference 2017-03-23 12:33:09 +00:00
Andy Wilkinson
b1227ce019 Remove recommendation about tweaking Surefire's configuration
Configuring Surefire to run tests found in files ending in
Documentation.java has the unwanted side-effect of switching off its
defaults, i.e. you end up with your documentation tests being run and
nothing else. While using a specific name for your documentation tests
can make them easier to identify, it isn't required. The documentation
also doesn't explicitly recommend using a Documentation suffix.

This commit simplifies things by removing the configuration that
changes Surefire's default inclusions.

Closes gh-368
2017-03-23 12:19:08 +00:00
Gerrit Meier
2fb3ede3a6 Document that port is omitted when it matches the scheme's default
Closes gh-325
Closes gh-329
2016-12-16 14:41:30 +00:00
stonio
9bbb60ac2a Clarify that parameterized output directory uses the simple class name
Closes gh-334
2016-12-16 14:32:35 +00:00
Andy Wilkinson
7ff45d273e Call the right endpoint in REST Assured field reuse example
Closes gh-324
2016-10-28 16:19:19 +01:00
Andy Wilkinson
0c64c781f4 Improve styling of groovy and adoc code blocks in the documentation
Closes gh-317
2016-10-21 23:09:47 +01:00
Andy Wilkinson
3dceea8bb5 Document the tableCellContent Mustache lambda
Closes gh-251
2016-07-22 14:19:13 +01:00
Andy Wilkinson
9c97c8b9bf Polish "Improve documention on how to use .adoc snippets"
See gh-279
2016-07-22 10:51:11 +01:00
mle
eb46eaa3c5 Improve documention on how to use .adoc snippets
Closes gh-279
2016-07-22 10:47:13 +01:00
Jennifer Strater
a1d5d75c4e Split samples table into three tables grouped by type
Closes gh-266
2016-06-27 16:08:36 +01:00
Jennifer Strater
64803b5fae Add Grails sample app
Closes gh-250
2016-05-31 10:00:40 +01:00
Andy Wilkinson
0446c99a10 Polishing
- Correct copyright years
- Add `@since` to javadoc of new public classes
- Make new classes final where appropriate
2016-05-25 11:26:02 +01:00
Andy Wilkinson
42353a0b5f Improve the API for generating additional snippets
Previously, if alwaysDo was used and the user wanted to generate
one or more additional snippets when calling perform a separate call
to `snippets` was made prior to calling `perform`. This had two
problems:

 - it required the result handler to be stateful (see gh-243)
 - it wasn't clear that the additional snippets would be produced when
   a subsequent call to perform was made

This commit introduces a new API that allows the additional snippets
to be specified within the MockMvc call. The old API has been
deprecated and will be removed in 2.0.

Closes gh-249
2016-05-25 11:01:48 +01:00
Johnny Lim
09c9cac857 Polish 2016-05-24 13:23:14 +01:00
Andy Wilkinson
fc3ae3b4a2 Add support for documenting the parts of a multipart request
Closes gh-161
2016-05-12 16:30:36 +01:00
Andy Wilkinson
d362f3f41f Document support for relaxed snippets
Closes gh-223
2016-05-05 14:47:03 +01:00
Andy Wilkinson
60a02a431f Improve documentation of project's requirements
Closes gh-217
2016-05-05 14:37:58 +01:00
Andy Wilkinson
0e52ef04a1 Document how to ignore common links without repetition
Closes gh-177
2016-04-22 11:18:27 +01:00
Andy Wilkinson
b62c5f0374 Make it easier to document common portions of req and resp payloads
This commit adds a new andWithPrefix(String, FieldDescriptor[]) method
to both RequestFieldsSnippet and ResponseFieldsSnippet. It can be
used to add descriptors to an existing snippet, applying the given
prefix to the additional descriptors as it does so. This allows the
descriptors for a portion of a payload to be created once and then
reused, irrespective of where in the payload the portion appears.

Closes gh-221
2016-04-22 10:30:52 +01:00
Andy Wilkinson
2897b8d1b4 Provide a preprocessor for modifying a request’s parameters
Closes gh-155
2016-04-13 17:50:19 +01:00
Andy Wilkinson
c4b7438708 Derive a link's description from its title
Previously, a LinkDescriptor had to be created with both a rel and a
description. If a description was not provided a failure would occur.

This commit relaxes the above-described restriction by allowing a
link's title to be used as its default description. If a descriptor
has a description, it will always be used irrespective of whether or
not the link has a title. If the descriptor does not have a
description and the link does have a title, the link's title will be
used. If the descriptor does not have a description and the link does
not have a title a failure will occur.

Closes gh-105
2016-04-13 16:16:15 +01:00
Andy Wilkinson
ae53a4e8eb Allow request and path parameters to be marked as optional
Closes gh-169
2016-04-13 12:38:36 +01:00
Andy Wilkinson
ecdc1971c2 Add default descriptions for Hibernate Validator's constraints
Closes gh-151
2016-04-13 12:00:56 +01:00
Andy Wilkinson
8b039e5f81 Add support for reusing a snippet to document common elements
This commit updates all of the Snippet implementations that take one
or more descriptors to provide an and method that can be used to
create a new Snippet that has additional descriptors.

Closes gh-168
2016-04-12 17:37:55 +01:00
Andy Wilkinson
feb2f352f6 Fix compiler warnings 2016-04-04 13:26:41 +01:00
Andy Wilkinson
976c31f860 Merge branch '1.0.x' 2016-04-04 11:43:57 +01:00
Andy Wilkinson
547c4f3fb1 Simplify documentation of Asciidoctor Maven plugin's phase
Previously the phase was documented as `package` by default with
instructions to change it to `prepare-package` if you want to
include the documentation in the project's package. This led to some
confusion and sometimes the step to change it to `prepare-package`
was missed.

This commit updates the documentation to recommend that
`prepare-package` is always used. It works equally well for both
cases (packaging the documentation or not) and avoids the possible
confusion described above.

Closes gh-218
2016-04-04 11:39:56 +01:00
Andy Wilkinson
37e16bc308 Polish contribution
This commit polishes the HTTPie request snippet contribution made in
b26d8c0. It makes the following significant changes:

- Applies project’s coding conventions for formatting and the like
- Moves to a composition-based approach for sharing functionality
  between the curl and HTTPie snippets by replacing AbstractCliSnippet
  with CliOperationRequest.
- Introduces a single package for CLI command snippets, thereby allowing
  more code to be package-private.

See gh-207
2016-03-09 17:38:04 +00:00
Raman Gupta
b26d8c085d Add support for generating an HTTPie snippet
This commit adds support for generating a snippet that contains
the HTTPie command for the request. As the snippet does not require
any additional configuration, it has added to the existing default
snippets.

Httpie does not currently support setting the content type for each
part in a multipart form -- these multipart types are currently
ignored. See:

    https://github.com/jkbrzt/httpie/issues/199
    https://github.com/jkbrzt/httpie/issues/271
    https://github.com/jkbrzt/httpie/pull/285
    https://github.com/jkbrzt/httpie/pull/398

There is an issue with specifying piped input for multipart form
data. There is no way currently to specify the data without specifying
a filename parameter in the Content-Disposition. For now, this is
ignored. See:

    https://github.com/jkbrzt/httpie/issues/342

See gh-207
2016-03-09 15:27:38 +00:00
Andy Wilkinson
ba76c2f843 Add a sample showing how to use Spring REST Docs with Slate
Closes gh-124
2016-02-15 17:52:08 +00:00
Andy Wilkinson
c8ecd25591 Add a sample demonstrating how to use REST Assured
Closes gh-198
2016-02-15 17:12:16 +00:00
Andy Wilkinson
26bae13b85 Merge branch '1.0.x' 2016-02-15 14:20:33 +00:00
Andy Wilkinson
4d44401efa Add a note in the documentation about use of the JVM's default charset
Closes gh-201
2016-02-15 12:43:32 +00:00
Andy Wilkinson
0ef9307481 Add support for manually managing the RestDocumentationContext
In 1.0, the reliance on JUnit was more widespread than it should have
been. It should have been isolated to the JUnit TestRule implementation,
RestDocumentation. Unfortunately, RestDocumentation was also an argument
to MockMvcRestDocumentation.documentationConfiguration which made it
impossible to use Spring REST Docs without having JUnit on the
classpath.

This commit introduces JUnitRestDocumentation and
ManualRestDocumentation. The format is a direct replacement for
RestDocumentation which has been reworked to delegate to
JUnitRestDocumentation. The latter allows manual management of the
RestDocumentationContext, primarily for use with TestNG.

A new interface, RestDocumentationContextProvider, has been introduced.
It is implemented by RestDocumentation, JUnitRestDocumentation and
ManualRestDocumentation.
MockMvcRestDocumentation.documentationConfiguration has been overridden
to also accept a RestDocumentationContextProvider. The method that
accepts a RestDocumentation has been deprecated, as has
RestDocumentation itself.

The documentation has been updated to encourage the use of
JUnitRestDocumentation and a sample illustrating the use of Spring REST
Docs with TestNG has been added.

Closes gh-171
2016-02-09 17:31:32 +00:00
Andy Wilkinson
6578f42730 Allow custom templates to be provided for a specific template format
Previously, custom snippet templates were loaded from
org/springframework/restdocs/templates and the default templates were
loaded from org/springframework/restdocs/templates/{$formatId}.
Without relying on the ordering of the classpath, this made it
impossible to provide a custom template for a specific format.

This commit updates the locations that are checked for snippet
templates. The following locations are now checked in order:

1. org/springframework/restdocs/templates/${formatId}/${name}.snippet
2. org/springframework/restdocs/templates/${name}.snippet
3. org/springframework/restdocs/templates/${formatId}/default-${name}.snippet

The second location is provided largely for backwards compatibility
with 1.0. Users are expected to use the first location to provide
any custom templates, with Spring REST Docs provided templates for
all of the built-in snippets in the third location.

Closes gh-196
Closes gh-197
2016-02-08 13:41:24 +00:00
Andy Wilkinson
cb9e10bf5a Break the package cycle caused by the introduction of SnippetFormat 2016-02-08 11:41:47 +00:00
Andy Wilkinson
1131c9fa6e Polish pattern-based header removal contribution
Closes gh-191
2016-02-05 09:36:28 +00:00
Roland Huß
1897ec54f2 Add support for removing headers that match a Pattern
A new preprocessor method `removeMatchingHeaders` has been introduced
which takes one or more regular expression patterns (as Strings). Any
header that matches a pattern is removed.

Closes gh-195
2016-02-05 09:32:29 +00:00
Andy Wilkinson
4d37dea1d6 Add support for generating snippets in Markdown
This commit introduces support for generating snippets formatted
using Markdown. Asciidoctor remains the default.

A new SnippetFormat abstraction has been introduced with Asciidoctor
and Markdown implementations provided out of the box.
Markdown-formatted templates are also provided for all of the default
snippets.

Please refer to the updated reference documentation for further
details.

Closes gh-150
Closes gh-19
2016-02-02 12:55:58 +00:00
Andy Wilkinson
130b411e2a Add support for using REST Assured to generate documentation snippets
This commit adds a new module, spring-restdocs-restassured, that
can be used to generate documentation snippets when testing a service
with REST Assured.

Please refer to the updated reference documentation for details.

Thanks to Johan Haleby for making a change to REST Assured so that
path parameters could be documented.

Closes gh-102
2016-01-29 12:31:37 +00:00
Andy Wilkinson
c7aaff7e7e Merge branch '1.0.x' 2016-01-27 17:19:19 +00:00
Grant Hutchins
d55b5b7738 Fix typo
Closes gh-188
2016-01-27 17:18:57 +00:00
Andy Wilkinson
5f4541bf69 Collapse Maven and Gradle setup into one section with switchable examples
This commit adds an Asciidoctor extension that post-processes code
blocks, collapsing any secondary blocks into the preceding primary
block. The primary block is then augmented with a switch. This switch
contains one item for each block. Clicking an item causes the associated
block’s content to be displayed. Each item is named using its block’s
title.

The getting started instructions have been updated to take advantage of
this new switching support, with the Maven and Gradle instructions
being collapsed into a single section.

Closes gh-189
2016-01-27 17:02:00 +00:00
Andy Wilkinson
d184425216 Polishing 2016-01-26 12:38:34 +00:00
Johnny Lim
a3c3bef093 Fix the link in the documentation to the default snippet templates
Closes gh-160
2015-12-03 17:54:43 +00:00