Commit Graph

365 Commits

Author SHA1 Message Date
Andy Wilkinson
cb1f98c601 Improve handling of parameters with null values
Closes gh-199
2016-05-24 16:39:57 +01:00
Andy Wilkinson
6935f603f2 Polish ResourceBundleConstraintDescriptionResolver and related tests
Closes gh-234
2016-05-24 16:27:37 +01:00
Andy Wilkinson
4715351cce Make it easier to provide a placeholder resolver that uses the context
Closes gh-235
2016-05-24 15:42:22 +01:00
Andy Wilkinson
a0f82f283b Merge pull request #247 from Marcel Overdijk
* gh-247:
  Polish "Allow descriptors to be provided as a List as well as via varags"
  Allow descriptors to be provided as a List as well as via varags
2016-05-24 13:59:19 +01:00
Andy Wilkinson
81b2f11ebf Polish "Allow descriptors to be provided as a List as well as via varags"
See gh-247
2016-05-24 13:54:17 +01:00
Marcel Overdijk
5edc27fc99 Allow descriptors to be provided as a List as well as via varags
Closes gh-247
2016-05-24 13:34:30 +01:00
Andy Wilkinson
7e116ae0cd Merge pull request #245 from Marcel Overdijk
* gh-245:
  Provide utility method for applying a path prefix to field descriptors
2016-05-24 13:29:47 +01:00
Marcel Overdijk
d58f69175f Provide utility method for applying a path prefix to field descriptors
applyPathPrefix is generally useful but, previously, it was only
available as a protected method on AbstractFieldsSnippet.

This commit moves the method from AbstractFieldsSnippet to
PayloadDocumentation where it's now public and static.

Closes gh-245
2016-05-24 13:27:30 +01:00
Andy Wilkinson
1132fa275c Merge pull request #240 from Johnny Lim
* gh-240:
  Polish
2016-05-24 13:24:27 +01:00
Johnny Lim
09c9cac857 Polish 2016-05-24 13:23:14 +01:00
Andy Wilkinson
3c80176e66 Merge branch '1.0.x' 2016-05-24 11:42:31 +01:00
Andy Wilkinson
ad549ae7c0 Ensure that additional snippets are only called once
Previously, when additional snippets were added to a
RestDocumentationResultHandler, those snippets would then be called
for every subsequent call to handle(MvcResult). This is problematic as
the snippets and their configuration are specific to a particular
MvcResult that is being documented.

This commit updates RestDocumentationResultHandler so that it clears
its additional snippets each time handle(MvcResult) is called.

Closes gh-243
2016-05-24 11:30:49 +01:00
Andy Wilkinson
7f02cdf725 Upgrade to JMustache 1.12
Closes gh-246
2016-05-24 11:04:30 +01:00
Andy Wilkinson
404b99b0a4 Avoid problems caused by | characters in table cell content
Previously, a | character in a cell of an Asciidoctor table would
break that table's formatting as it would be interpretted as a
delimiter for the cell. The problem also affects Markdown tables where
the | character is not within backticks.

This commit addresses the problem with Asciidoctor tables by
introducing a JMustache Lambda that escapes | characters by prefixing
them with a backslash.

Unfortunately, a complete solution to the problem when using Markdown
is not as straightforward. Markdown only requires a | character to be
espaced when it is not within backticks. Determing this isn't
straightforward as the text would have to be parsed, taking into
account the possibility of backticks themselves being escaped.
Instead, this commit attempts to avoid the problem in a different way.

The most likely source of a | character is when documenting a
`@Pattern` constraint that uses a | character in its regular
expression. To improve the readability of the regular expression this
commit wraps it in backticks, thereby formatting it in a monospaced
font in both Asciidoctor and Markdown and also avoiding any escaping
problems with the latter.

Closes gh-232
See gh-230
2016-05-24 10:50:32 +01:00
Andy Wilkinson
65e55ac15c Allow descriptors to be added using a List in addition to varags
Closes gh-242
2016-05-23 16:11:32 +01:00
Andy Wilkinson
117e8ec096 Provide an API for configuring additional default snippets
Previously, the default snippets could only be configured by
replacing those that are configured out of the box. This commit adds
a method, withAdditionalDefaults, that can be used to add one or more
snippets to those that are configured out of the box.

Closes gh-237
2016-05-23 15:51:17 +01:00
Andy Wilkinson
1c04ddc7e5 Update contributing section, add link to Gitter chat room
Closes gh-238
2016-05-23 15:38:49 +01:00
Andy Wilkinson
950f889a7e Merge branch '1.0.x' 2016-05-17 17:15:19 +01:00
Andy Wilkinson
b81c03646f Polish MustacheTemplate's javadoc 2016-05-17 17:15:01 +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
63a6ad2c91 Improve readability by using monospaced font in various snippets
This commit updates a number of the snippets to use a monospaced font
for parts of their output. The changes are:

- Links snippet: rel
- Path parameters: name
- Request fields: path and type
- Request headers: name
- Request parameters: name
- Response fields: path and type
- Response headers: name

Closes gh-230
2016-05-11 14:50:39 +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
75ea210187 Build against Spring Framework 4.2.x 2016-05-05 14:29:20 +01:00
Andy Wilkinson
f23d947cb5 Use Spring Boot 1.3.3 to test REST Assured module 2016-05-05 14:11:49 +01:00
Andy Wilkinson
a0236f67eb Build using Java 8 on Travis 2016-05-05 14:06:12 +01:00
Andy Wilkinson
bf9d977321 Try a different approach to switching off the Gradle daemon on Travis 2016-05-05 14:00:09 +01:00
Andy Wilkinson
4a67b80b15 Try --info. Travis can't cope with volume produced by --debug 2016-05-05 13:53:57 +01:00
Andy Wilkinson
4d5f0df17e Try to coax some useful diagnostics out of failing Travis build 2016-05-05 13:49:08 +01:00
Andy Wilkinson
0c917546de Merge branch '1.0.x' 2016-05-05 13:37:55 +01:00
Andy Wilkinson
2417e9588d Disable Gradle daemon when building on Travis 2016-05-05 13:37:36 +01:00
Andy Wilkinson
68bb29937e Merge branch '1.0.x' 2016-05-05 13:26:20 +01:00
Andy Wilkinson
40a12127d7 Alternative approach to getting a stacktrace for a sample build failure 2016-05-05 13:25:10 +01:00
Andy Wilkinson
5e2552f8c4 Merge branch '1.0.x' 2016-05-05 12:48:23 +01:00
Andy Wilkinson
6a5fd53910 Update Asciidoctor dependencies 2016-05-05 12:47:22 +01:00
Andy Wilkinson
615e568dec Merge branch '1.0.x' 2016-05-05 12:32:11 +01:00
Andy Wilkinson
99b84e40f4 Output stacktrace when Gradle samples fails to build 2016-05-05 12:29:17 +01:00
Andy Wilkinson
873159cec8 Merge branch '1.0.x' 2016-05-05 11:36:25 +01:00
Andy Wilkinson
e37d0ff560 Use Maven Central rather than JCenter 2016-05-05 11:35:07 +01:00
Andy Wilkinson
9e84922e09 Upgrade samples to Spring Boot 1.3.3.RELEASE
Closes gh-222
2016-05-05 11:29:45 +01:00
Andy Wilkinson
1c95232e67 Include optional attribute in model for path and req param descriptors 2016-05-05 10:37:19 +01:00
Andy Wilkinson
5b32a3aa98 Optional path and req param descriptors should count as documented
Previously, optional path and request parameter descriptors were
ignored when checking that all of the parameters that are present
had been documented. This lead to a false negative if a request
or path parameter was present and was documented with an optional
descriptor.

This commit uses all of the descriptors, not just those that are not
optional, when checking for undocumented parameters.

Closes gh-228
2016-05-05 10:34:02 +01:00
Andy Wilkinson
b15ee5918d Merge branch '1.0.x' 2016-05-05 10:24:36 +01:00
Andy Wilkinson
96330b2e30 Improve testing of optional links and request and response fields 2016-05-05 10:05:20 +01:00
Andy Wilkinson
130ea784f7 Merge branch '1.0.x' 2016-05-05 09:53:30 +01:00
Andy Wilkinson
a3e6883524 Apply Eclipse Mars (4.5.2) code formatting 2016-05-05 09:50:01 +01:00
Andy Wilkinson
043e796502 Introduce relaxed snippets that don’t fail when item is not documented
Previously, many of the snippets would fail when something wasn’t
documented. This worked well when writing exhaustive API documentation,
but was cumbersome when trying to document a scenario that might only
being interested in a subset of the links, response fields, etc. It was
necessary to mark things that were not of interest as being ignored.

This commit introduces a relaxed variant of several snippets. A relaxed
snippet will not fail if something has not been documented. Instead,
the undocumented thing will be ignored. If something has been documented
but it does not exist a failure will still occur.

Closes gh-175
2016-04-22 12:41:05 +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