Commit Graph

328 Commits

Author SHA1 Message Date
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
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
984f90fa7b Merge branch '1.0.x' 2016-04-13 14:15:04 +01:00
Andy Wilkinson
032b7b59dc Fix HalLinkExtractor's extraction of link hrefs
Closes gh-220
2016-04-13 14:09:08 +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
e5aa5ba728 Make it easier to write a preprocessor that only changes req or resp
The commit introduces OperationPreprocessorAdapter, an abstract
implementation of OperationProcessor that returns to request and
response as-is. OperationPreprocessorAdapter is intended to be
subclassed by OperationProcessor implementations that only modify
the request or the response. Implementations the modify both should
continue to implement OperationPreprocess directly.

Closes gh-154
2016-04-13 10:07:41 +01:00
Andy Wilkinson
2da1a0a979 Update tests following nowrap changes made in bab779a
Closes gh-204
2016-04-12 19:36:34 +01:00
Andy Wilkinson
bab779ac91 Disable wrapping in Asciidoctor HTTP request and response snippets
The HTTP request and response snippets are intended to be an exact
representation of the HTTP request or response which would not wrap.
This commit disables wrapping by adding the nowrap option to the
default templates for these two snippets.

Closes gh-204
2016-04-12 17:50: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
83e8b92c3b Upgrade to Gradle 2.12 2016-04-04 11:55:52 +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
72aeed6bd2 Merge pull request #208 from Johnny Lim
* gh-208:
  Fix typo
2016-04-04 11:17:20 +01:00
Johnny Lim
05f738d12c Fix typo 2016-04-04 11:17:17 +01:00
Andy Wilkinson
cb39af5163 Improve the formatting of the default Markdown path parameters snippet
Add the required blank line between the table "title" and the
table itself. Without this blank line the table wasn't not formatted
correctly. The "title" has also been wrapped in back ticks to improve
its formatting in the generated HTML.

Closes gh-212
2016-04-04 11:12:15 +01:00
Andy Wilkinson
488d36d4bf Do not double-encode URIs when they are being modified
Previously, when UriModifyingOperationPreprocessor modified a URI it
would always encode it. However, the URIs being modified will always
have been encoded, resulting in double-encoding of the URI.

This commit updates UriModifyingOperationPreprocessor to tell
UriComponentsBuilder that the components have already been encoded.
This ensures that they are not encoded for a second time when the URI
is being built.

Closes gh-211
2016-04-04 10:51:23 +01:00
Andy Wilkinson
6ea6dcf996 Fix test failures on Windows caused by different new line characters 2016-03-09 17:51:48 +00:00
Andy Wilkinson
7a3fe6b72c Merge pull request #207 from Raman Gupta
* gh-207:
  Polish contribution
  Add support for generating an HTTPie snippet

Closes gh-207
2016-03-09 17:38:34 +00: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
536e49287d Update tests to cope with different Content-Type charset attribute 2016-03-01 09:38:43 +00:00
Andy Wilkinson
ee865ce4ed Tolerate relocated test-related classes in Spring Boot 1.4 2016-02-22 10:13:35 +00:00
Andy Wilkinson
67920dd9f6 Merge branch '1.0.x' 2016-02-16 11:12:54 +00:00
Andy Wilkinson
36bacb470b Move to the offical SonarQube plugin 2016-02-16 11:11:53 +00:00
Andy Wilkinson
d84fca4d63 Ensure that version updates are applied to Slate sample 2016-02-16 10:47:07 +00:00
Andy Wilkinson
4c5095589a Ensure that REST Assured module is installed before sample is built 2016-02-15 17:57:51 +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
b224333c97 Upgrade to Gradle 2.11 2016-02-15 17:17:36 +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
7e2a3dcd18 Fix faulty forward merge 2016-02-15 16:04:42 +00:00
Andy Wilkinson
228424e497 Merge branch '1.0.x' 2016-02-15 15:50:08 +00:00
Andy Wilkinson
40201e2e99 Improve handling of empty parameters in curl and HTTP request snippets
Previously, both the curl and HTTP request snippets would ignore
a parameter with no value, for example from the query string of the
url http://localhost:8080/foo?bar.

This commit updates both snippets so that such parameters are
included in the generated snippet, including a multi-part request
that is uploading form data and a field in the form has no value.
Additions have been made to the tests for both snippets.

While the request parameters snippet correctly handled parameters with
no value, there was no test verifying that this was the case. One
has been added in this commit.

Closes gh-200
2016-02-15 15:41:09 +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
7fc5ac10d0 Merge branch '1.0.x' 2016-02-15 12:30:42 +00:00
Andy Wilkinson
cfc413f7ed Avoid byte[] to String to byte[] conversion when pretty printing
Previously, PrettyPrintingContentModifier would convert the byte[]
content into a String and then back into a byte[]. It did so without
consideration for the content’s character set. As a result, it could
fail to preserve the correct character encoding.

This commit updates PrettyPrintingContentModifier to avoid converting
the content into a String and back into a byte[] and to work entirely
with byte arrays instead. Removing the intermediate String from the
process removes the possibility of the content becoming corrupted.

Closes gh-202
2016-02-15 12:28:07 +00:00